weka.classifiers.functions
Class SMOreg

java.lang.Object
  extended by weka.classifiers.Classifier
      extended by weka.classifiers.functions.SMOreg
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler, WeightedInstancesHandler

public class SMOreg
extends Classifier
implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler

Implements Alex Smola and Bernhard Scholkopf's sequential minimal optimization algorithm for training a support vector regression model. This implementation globally replaces all missing values and transforms nominal attributes into binary ones. It also normalizes all attributes by default. (Note that the coefficients in the output are based on the normalized/standardized data, not the original data.)

For more information on the SMO algorithm, see

Alex J. Smola, Bernhard Schoelkopf: A Tutorial on Support Vector Regression. In NeuroCOLT2 Technical Report Series, 1998.

S.K. Shevade, S.S. Keerthi, C. Bhattacharyya, K.R.K. Murthy (1999). Improvements to SMO Algorithm for SVM Regression. Control Division Dept of Mechanical and Production Engineering, National University of Singapore.

BibTeX:

 @incollection{Smola1998,
    author = {Alex J. Smola and Bernhard Schoelkopf},
    booktitle = {NeuroCOLT2 Technical Report Series},
    note = {NC2-TR-1998-030},
    title = {A Tutorial on Support Vector Regression},
    year = {1998}
 }
 
 @techreport{Shevade1999,
    address = {Control Division Dept of Mechanical and Production Engineering, National University of Singapore},
    author = {S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy},
    institution = {National University of Singapore},
    note = {Technical Report CD-99-16},
    title = {Improvements to SMO Algorithm for SVM Regression},
    year = {1999}
 }
 

Valid options are:

 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -no-checks
  Turns off all checks - use with caution!
  Turning them off assumes that data is purely numeric, doesn't
  contain any missing values, and has a nominal class. Turning them
  off also means that no header information will be stored if the
  machine is linear. Finally, it also assumes that no instance has
  a weight equal to 0.
  (default: checks on)
 -S <double>
  The amount up to which deviations are
  tolerated (epsilon). (default 1e-3)
 -C <double>
  The complexity constant C. (default 1)
 -N
  Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
 -T <double>
  The tolerance parameter. (default 1.0e-3)
 -P <double>
  The epsilon for round-off error. (default 1.0e-12)
 -K <classname and parameters>
  The Kernel to use.
  (default: weka.classifiers.functions.supportVector.PolyKernel)
 
 Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
 
 -D
  Enables debugging output (if available) to be printed.
  (default: off)
 -no-checks
  Turns off all checks - use with caution!
  (default: checks on)
 -C <num>
  The size of the cache (a prime number), 0 for full cache and 
  -1 to turn it off.
  (default: 250007)
 -E <num>
  The Exponent to use.
  (default: 1.0)
 -L
  Use lower-order terms.
  (default: no)

Version:
$Revision: 1.14 $
Author:
Sylvain Roy (sro33@student.canterbury.ac.nz)
See Also:
Serialized Form

Field Summary
static int FILTER_NONE
          no filtering
static int FILTER_NORMALIZE
          normalize data
static int FILTER_STANDARDIZE
          standardize data
static Tag[] TAGS_FILTER
          The filter to apply to the training data
 
Constructor Summary
SMOreg()
           
 
Method Summary
 void buildClassifier(Instances insts)
          Method for building the classifier.
 java.lang.String checksTurnedOffTipText()
          Returns the tip text for this property
 double classifyInstance(Instance inst)
          Classifies a given instance.
 java.lang.String cTipText()
          Returns the tip text for this property
 java.lang.String epsilonTipText()
          Returns the tip text for this property
 java.lang.String epsTipText()
          Returns the tip text for this property
 java.lang.String filterTypeTipText()
          Returns the tip text for this property
 double getC()
          Get the value of C.
 Capabilities getCapabilities()
          Returns default capabilities of the classifier.
 boolean getChecksTurnedOff()
          Returns whether the checks are turned off or not.
 double getEps()
          Get the value of eps.
 double getEpsilon()
          Get the value of epsilon.
 SelectedTag getFilterType()
          Gets how the training data will be transformed.
 Kernel getKernel()
          Gets the kernel to use.
 java.lang.String[] getOptions()
          Gets the current settings of the classifier.
 java.lang.String getRevision()
          Returns the revision string.
 TechnicalInformation getTechnicalInformation()
          Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
 double getToleranceParameter()
          Get the value of tolerance parameter.
 java.lang.String globalInfo()
          Returns a string describing classifier
 java.lang.String kernelTipText()
          Returns the tip text for this property
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class.
 void setC(double v)
          Set the value of C.
 void setChecksTurnedOff(boolean value)
          Disables or enables the checks (which could be time-consuming).
 void setEps(double v)
          Set the value of eps.
 void setEpsilon(double v)
          Set the value of epsilon.
 void setFilterType(SelectedTag newType)
          Sets how the training data will be transformed.
 void setKernel(Kernel value)
          Sets the kernel to use.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setToleranceParameter(double v)
          Set the value of tolerance parameter.
 java.lang.String toleranceParameterTipText()
          Returns the tip text for this property
 java.lang.String toString()
          Prints out the classifier.
 void turnChecksOff()
          Turns off checks for missing values, etc.
 void turnChecksOn()
          Turns on checks for missing values, etc.
 
Methods inherited from class weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILTER_NORMALIZE

public static final int FILTER_NORMALIZE
normalize data

See Also:
Constant Field Values

FILTER_STANDARDIZE

public static final int FILTER_STANDARDIZE
standardize data

See Also:
Constant Field Values

FILTER_NONE

public static final int FILTER_NONE
no filtering

See Also:
Constant Field Values

TAGS_FILTER

public static final Tag[] TAGS_FILTER
The filter to apply to the training data

Constructor Detail

SMOreg

public SMOreg()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing classifier

Returns:
a description suitable for displaying in the explorer/experimenter gui

getTechnicalInformation

public TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.

Specified by:
getTechnicalInformation in interface TechnicalInformationHandler
Returns:
the technical information about this class

getCapabilities

public Capabilities getCapabilities()
Returns default capabilities of the classifier.

Specified by:
getCapabilities in interface CapabilitiesHandler
Overrides:
getCapabilities in class Classifier
Returns:
the capabilities of this classifier
See Also:
Capabilities

buildClassifier

public void buildClassifier(Instances insts)
                     throws java.lang.Exception
Method for building the classifier.

Specified by:
buildClassifier in class Classifier
Parameters:
insts - the set of training instances
Throws:
java.lang.Exception - if the classifier can't be built successfully

classifyInstance

public double classifyInstance(Instance inst)
                        throws java.lang.Exception
Classifies a given instance.

Overrides:
classifyInstance in class Classifier
Parameters:
inst - the instance to be classified
Returns:
the classification
Throws:
java.lang.Exception - if instance could not be classified successfully

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class Classifier
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the classifier.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions

setChecksTurnedOff

public void setChecksTurnedOff(boolean value)
Disables or enables the checks (which could be time-consuming). Use with caution!

Parameters:
value - if true turns off all checks

getChecksTurnedOff

public boolean getChecksTurnedOff()
Returns whether the checks are turned off or not.

Returns:
true if the checks are turned off

checksTurnedOffTipText

public java.lang.String checksTurnedOffTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

kernelTipText

public java.lang.String kernelTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getKernel

public Kernel getKernel()
Gets the kernel to use.

Returns:
the kernel

setKernel

public void setKernel(Kernel value)
Sets the kernel to use.

Parameters:
value - the kernel

filterTypeTipText

public java.lang.String filterTypeTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getFilterType

public SelectedTag getFilterType()
Gets how the training data will be transformed. Will be one of FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.

Returns:
the filtering mode

setFilterType

public void setFilterType(SelectedTag newType)
Sets how the training data will be transformed. Should be one of FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.

Parameters:
newType - the new filtering mode

cTipText

public java.lang.String cTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getC

public double getC()
Get the value of C.

Returns:
Value of C.

setC

public void setC(double v)
Set the value of C.

Parameters:
v - Value to assign to C.

toleranceParameterTipText

public java.lang.String toleranceParameterTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getToleranceParameter

public double getToleranceParameter()
Get the value of tolerance parameter.

Returns:
Value of tolerance parameter.

setToleranceParameter

public void setToleranceParameter(double v)
Set the value of tolerance parameter.

Parameters:
v - Value to assign to tolerance parameter.

epsTipText

public java.lang.String epsTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getEps

public double getEps()
Get the value of eps.

Returns:
Value of eps.

setEps

public void setEps(double v)
Set the value of eps.

Parameters:
v - Value to assign to epsilon.

epsilonTipText

public java.lang.String epsilonTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getEpsilon

public double getEpsilon()
Get the value of epsilon.

Returns:
Value of epsilon.

setEpsilon

public void setEpsilon(double v)
Set the value of epsilon.

Parameters:
v - Value to assign to epsilon.

turnChecksOff

public void turnChecksOff()
Turns off checks for missing values, etc. Use with caution.


turnChecksOn

public void turnChecksOn()
Turns on checks for missing values, etc.


toString

public java.lang.String toString()
Prints out the classifier.

Overrides:
toString in class java.lang.Object
Returns:
a description of the classifier as a string

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - the commandline options

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Returns:
the revision