Class SVOneClass

All Implemented Interfaces:
Serializable, Cloneable

public class SVOneClass extends SupportVectorMachine implements Serializable, Cloneable
Specifies a support vector machine for the one class problem. The one class SVM estimates the support (the range of values with positive density) of a high-dimensional distribution.

The one-class SVM algorithm estimates the support of a high-dimensional distribution without any class information. The primal problem of one-class SVM is

$$\min_ {w, \xi, \rho} \frac{1}{2} w^Tw-\rho+\frac{1}{\nu l}\sum_{i=1}^{l} \xi _i$$

$$\text{subject to} \, \, (w^T \phi (x_i)) \geq \rho - \xi _i,$$

$$ \xi _i \geq 0, i=1, \, \ldots \,,\,l$$

See Also:
  • Constructor Details

    • SVOneClass

      public SVOneClass(double[][] xy, int responseColumnIndex, PredictiveModel.VariableType[] varType)
      Constructs a one class support vector machine.
      Parameters:
      xy - a double matrix containing the training data and associated response values by the number of variables
      responseColumnIndex - an int, 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
    • SVOneClass

      public SVOneClass(double[][] xy, int responseColumnIndex, PredictiveModel.VariableType[] varType, Kernel k)
      Constructs a one class support vector machine.
      Parameters:
      xy - a double matrix containing the training data and associated response values
      responseColumnIndex - an int, 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
    • SVOneClass

      public SVOneClass(SVOneClass oneClassModel)
      Constructs a copy of the input SVOneClass predictive model.
      Parameters:
      oneClassModel - an SVOneClass predictive model
  • Method Details

    • clone

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

      protected SVModel optimize(DataNode[][] x, double[] y, double[] w, int len, Kernel kernel) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
      Performs the one class 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