All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.SMO

java.lang.Object
   |
   +----weka.classifiers.Classifier
           |
           +----weka.classifiers.DistributionClassifier
                   |
                   +----weka.classifiers.SMO

public class SMO
extends DistributionClassifier
implements OptionHandler
Implements John C. Platt's sequential minimal optimization algorithm for training a support vector classifier using polynomial kernels. Transforms output of SVM into probabilities by applying a standard sigmoid function that is not fitted to the data. This implementation globally replaces all missing values and transforms nominal attributes into binary ones. For more information on the SMO algorithm, see

J. Platt (1998). Fast Training of Support Vector Machines using Sequential Minimal Optimization. Advances in Kernel Methods - Support Vector Learning, B. Schölkopf, C. Burges, and A. Smola, eds., MIT Press.

S.S. Keerthi, S.K. Shevade, C. Bhattacharyya, K.R.K. Murthy (1999). Improvements to Platt's SMO Algorithm for SVM Classifier Design. Technical Report CD-99-14. Control Division, Dept of Mechanical and Production Engineering, National University of Singapore.

Note: for improved speed normalization should be turned off when operating on SparseInstances.

Valid options are:

-C num
The complexity constant C. (default 1)

-E num
The exponent for the polynomial kernel. (default 1)

-N
Don't normalize the training instances.

-L
Rescale kernel.

-O
Use lower-order terms.

-A num
Sets the size of the kernel cache. Should be a prime number. (default 1000003)

-T num
Sets the tolerance parameter. (default 1.0e-3)

-P num
Sets the epsilon for round-off error. (default 1.0e-12)

Author:
Eibe Frank (eibe@cs.waikato.ac.nz), Shane Legg (shane@intelligenesis.net) (sparse vector code), Stuart Inglis (stuart@intelligenesis.net) (sparse vector code)

Constructor Index

 o SMO()

Method Index

 o buildClassifier(Instances)
Method for building the classifier.
 o distributionForInstance(Instance)
Outputs the distribution for the given output.
 o getC()
Get the value of C.
 o getCacheSize()
Get the size of the kernel cache
 o getEpsilon()
Get the value of epsilon.
 o getExponent()
Get the value of exponent.
 o getLowerOrderTerms()
Check whether lower-order terms are being used.
 o getNormalizeData()
Check whether data is to be normalized.
 o getOptions()
Gets the current settings of the classifier.
 o getRescaleKernel()
Check whether kernel is being rescaled.
 o getToleranceParameter()
Get the value of tolerance parameter.
 o listOptions()
Returns an enumeration describing the available options
 o main(String[])
Main method for testing this class.
 o setC(double)
Set the value of C.
 o setCacheSize(int)
Set the value of the kernel cache.
 o setEpsilon(double)
Set the value of epsilon.
 o setExponent(double)
Set the value of exponent.
 o setLowerOrderTerms(boolean)
Set whether lower-order terms are to be used.
 o setNormalizeData(boolean)
Set whether data is to be normalized.
 o setOptions(String[])
Parses a given list of options.
 o setRescaleKernel(boolean)
Set whether kernel is to be rescaled.
 o setToleranceParameter(double)
Set the value of tolerance parameter.
 o toString()
Prints out the classifier.

Constructors

 o SMO
 public SMO()

Methods

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

Parameters:
insts - the set of training instances
Throws: Exception
if the classifier can't be built successfully
Overrides:
buildClassifier in class Classifier
 o distributionForInstance
 public double[] distributionForInstance(Instance inst) throws Exception
Outputs the distribution for the given output. Pipes output of SVM through sigmoid function.

Parameters:
inst - the instance for which distribution is to be computed
Returns:
the distribution
Throws: Exception
if something goes wrong
Overrides:
distributionForInstance in class DistributionClassifier
 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

Returns:
an enumeration of all the available options
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-C num
The complexity constant C. (default 1)

-E num
The exponent for the polynomial kernel. (default 1)

-N
Don't normalize the training instances.

-L
Rescale kernel.

-O
Use lower-order terms.

-A num
Sets the size of the kernel cache. Should be a prime number. (default 1000003)

-T num
Sets the tolerance parameter. (default 1.0e-3)

-P num
Sets the epsilon for round-off error. (default 1.0e-12)

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o getOptions
 public String[] getOptions()
Gets the current settings of the classifier.

Returns:
an array of strings suitable for passing to setOptions
 o toString
 public String toString()
Prints out the classifier.

Returns:
a description of the classifier as a string
Overrides:
toString in class Object
 o getExponent
 public double getExponent()
Get the value of exponent.

Returns:
Value of exponent.
 o setExponent
 public void setExponent(double v)
Set the value of exponent. If linear kernel is used, rescaling and lower-order terms are turned off.

Parameters:
v - Value to assign to exponent.
 o getC
 public double getC()
Get the value of C.

Returns:
Value of C.
 o setC
 public void setC(double v)
Set the value of C.

Parameters:
v - Value to assign to C.
 o getToleranceParameter
 public double getToleranceParameter()
Get the value of tolerance parameter.

Returns:
Value of tolerance parameter.
 o setToleranceParameter
 public void setToleranceParameter(double v)
Set the value of tolerance parameter.

Parameters:
v - Value to assign to tolerance parameter.
 o getEpsilon
 public double getEpsilon()
Get the value of epsilon.

Returns:
Value of epsilon.
 o setEpsilon
 public void setEpsilon(double v)
Set the value of epsilon.

Parameters:
v - Value to assign to epsilon.
 o getCacheSize
 public int getCacheSize()
Get the size of the kernel cache

Returns:
Size of kernel cache.
 o setCacheSize
 public void setCacheSize(int v)
Set the value of the kernel cache.

Parameters:
v - Size of kernel cache.
 o getNormalizeData
 public boolean getNormalizeData()
Check whether data is to be normalized.

Returns:
true if data is to be normalized
 o setNormalizeData
 public void setNormalizeData(boolean v)
Set whether data is to be normalized.

Parameters:
v - true if data is to be normalized
 o getRescaleKernel
 public boolean getRescaleKernel() throws Exception
Check whether kernel is being rescaled.

Returns:
Value of rescale.
 o setRescaleKernel
 public void setRescaleKernel(boolean v) throws Exception
Set whether kernel is to be rescaled. Defaults to false if a linear machine is built.

Parameters:
v - Value to assign to rescale.
 o getLowerOrderTerms
 public boolean getLowerOrderTerms()
Check whether lower-order terms are being used.

Returns:
Value of lowerOrder.
 o setLowerOrderTerms
 public void setLowerOrderTerms(boolean v)
Set whether lower-order terms are to be used. Defaults to false if a linear machine is built.

Parameters:
v - Value to assign to lowerOrder.
 o main
 public static void main(String argv[])
Main method for testing this class.


All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home