Class SVRegression

All Implemented Interfaces:
Serializable, Cloneable

public class SVRegression extends SupportVectorMachine implements Serializable, Cloneable
Specifies a support vector machine for regression (SVR).

The standard form SVR is the so-called epsilon-support vector regression, or \(\varepsilon\)-SVR. If \(z_i\) is the target output, then given the parameters \(C > \, 0, \varepsilon > \, 0\), the standard form SVR is

$$\min_ {w, b, \xi, \xi^*} \frac{1}{2} w^Tw+C\sum_{i=1}^{l} \xi _i + C\sum_{i=1}^{l} {\xi _i}^*$$

$$\text{subject to} \, \, w^T \phi (x_i)+b-z_i \leq \varepsilon +\xi _i,$$

$$z_i - w^T \phi (x_i)-b \leq \varepsilon +{\xi _i}^*,$$

$$ \xi_i, {\xi_i}^* \geq 0, i=1, \ldots, l $$

The variables \(\xi _i\) and \({\xi _i}^*\) are two slack variables, one for exceeding the target value by more than \(\epsilon\) and the other for being more than \(\epsilon\) below the target. \(\epsilon\) is controlled through the use of the set method setInsensitivityBand.

See Also:
  • Constructor Details

    • SVRegression

      public SVRegression(double[][] xy, int responseColumnIndex, PredictiveModel.VariableType[] varType)
      Constructs a support vector machine for regression (SVR).
      Parameters:
      xy - a double matrix containing the training data and associated response values
      responseColumnIndex - an int specifying the column index of the response variable
      varType - a PredictiveModel.VariableType array of length equal to xy[0].length containing the type of each variable
    • SVRegression

      public SVRegression(SVRegression svrModel)
      Constructs a copy of the input SVRegression predictive model.
      Parameters:
      svrModel - an SVRegression predictive model
    • SVRegression

      public SVRegression(double[][] xy, int responseColumnIndex, PredictiveModel.VariableType[] varType, Kernel k)
      Constructs a support vector machine for regression (SVR).
      Parameters:
      xy - a double matrix containing the training data and associated response values
      responseColumnIndex - an int specifying the column index of the response variable
      varType - a PredictiveModel.VariableType array of length equal to xy[0].length containing the type of each variable
      k - a Kernel, the kernel function
  • Method Details

    • clone

      public SVRegression clone()
      Clones an SVRegression predictive model.
      Specified by:
      clone in class PredictiveModel
      Returns:
      a clone of the SVRegression predictive model
    • setConfiguration

      protected final void setConfiguration(PredictiveModel pm)
      Sets the configuration to that of the input PredictiveModel.

      Note that the input PredictiveModel object must be the same subclass of PredictiveModel as is this instance.

      Overrides:
      setConfiguration in class SupportVectorMachine
      Parameters:
      pm - a SVRegression instance

      Default: The class uses its default configuration as described in the different methods.

    • getInsensitivityBand

      public double getInsensitivityBand()
      Returns the insensitivity band parameter, \(\epsilon\), in the standard formulation of the SVM regression problem.
      Returns:
      a double, the value of the insensitivity band parameter
    • setInsensitivityBand

      public void setInsensitivityBand(double epsilon)
      Sets the insensitivity band parameter, \(\epsilon\), in the standard formulation of the SVM regression problem.
      Parameters:
      epsilon - a double > 0.0, the value of the infeasibility band parameter

      Default: epsilon=0.1

    • optimize

      protected SVModel optimize(DataNode[][] x, double[] y, double[] w, int len, Kernel kernel) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Performs the regression support vector machine optimization problem.
      Specified by:
      optimize in class SupportVectorMachine
      Parameters:
      x - a DataNode matrix containing the attribute data
      y - a double array containing the response variable
      len - an int, the total possible number of support vectors
      w - a double array containing the observation weights
      kernel - a Kernel object
      Returns:
      an SVModel structure containing the fitted model
      Throws:
      NoSuchMethodException - thrown when a particular method cannot be found
      InstantiationException - thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated
      IllegalAccessException - thrown when an application tries to reflectively create an instance (other than an array), set or get a field, or invoke a method, but the currently executing method does not have access to the definition of the specified class, field, method or constructor
      InvocationTargetException - a checked exception that wraps an exception thrown by an invoked method or constructor
    • predictValues

      protected double[] predictValues(SVModel model, double[][] attributeData) throws PredictiveModel.SumOfProbabilitiesNotOneException
      Generates the predicted values on the attribute data using the given support vector machine model.
      Specified by:
      predictValues in class SupportVectorMachine
      Parameters:
      model - a fitted SVModel object
      attributeData - a double matrix containing the attribute (or predictor) data
      Returns:
      a double array containing the predictions for each row in the input attribute data
      Throws:
      PredictiveModel.SumOfProbabilitiesNotOneException - the sum of probabilities is not approximately one