|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.DistributionClassifier | +--weka.classifiers.SMO
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)
Constructor Summary | |
SMO()
|
Method Summary | |
void |
buildClassifier(Instances insts)
Method for building the classifier. |
double[] |
distributionForInstance(Instance inst)
Outputs the distribution for the given output. |
double |
getC()
Get the value of C. |
int |
getCacheSize()
Get the size of the kernel cache |
double |
getEpsilon()
Get the value of epsilon. |
double |
getExponent()
Get the value of exponent. |
boolean |
getLowerOrderTerms()
Check whether lower-order terms are being used. |
boolean |
getNormalizeData()
Check whether data is to be normalized. |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
boolean |
getRescaleKernel()
Check whether kernel is being rescaled. |
double |
getToleranceParameter()
Get the value of tolerance parameter. |
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 |
setCacheSize(int v)
Set the value of the kernel cache. |
void |
setEpsilon(double v)
Set the value of epsilon. |
void |
setExponent(double v)
Set the value of exponent. |
void |
setLowerOrderTerms(boolean v)
Set whether lower-order terms are to be used. |
void |
setNormalizeData(boolean v)
Set whether data is to be normalized. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRescaleKernel(boolean v)
Set whether kernel is to be rescaled. |
void |
setToleranceParameter(double v)
Set the value of tolerance parameter. |
java.lang.String |
toString()
Prints out the classifier. |
Methods inherited from class weka.classifiers.DistributionClassifier |
classifyInstance |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SMO()
Method Detail |
public void buildClassifier(Instances insts) throws java.lang.Exception
buildClassifier
in class Classifier
insts
- the set of training instancesjava.lang.Exception
- if the classifier can't be built successfullypublic double[] distributionForInstance(Instance inst) throws java.lang.Exception
distributionForInstance
in class DistributionClassifier
inst
- the instance for which distribution is to be computedjava.lang.Exception
- if something goes wrongpublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-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)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public java.lang.String toString()
toString
in class java.lang.Object
public double getExponent()
public void setExponent(double v)
v
- Value to assign to exponent.public double getC()
public void setC(double v)
v
- Value to assign to C.public double getToleranceParameter()
public void setToleranceParameter(double v)
v
- Value to assign to tolerance parameter.public double getEpsilon()
public void setEpsilon(double v)
v
- Value to assign to epsilon.public int getCacheSize()
public void setCacheSize(int v)
v
- Size of kernel cache.public boolean getNormalizeData()
public void setNormalizeData(boolean v)
v
- true if data is to be normalizedpublic boolean getRescaleKernel() throws java.lang.Exception
public void setRescaleKernel(boolean v) throws java.lang.Exception
v
- Value to assign to rescale.public boolean getLowerOrderTerms()
public void setLowerOrderTerms(boolean v)
v
- Value to assign to lowerOrder.public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |