类 SMO

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.functions.SMO
所有已实现的接口:
Serializable, Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler, WeightedInstancesHandler

Implements John Platt's sequential minimal optimization algorithm for training a support vector classifier.

This implementation globally replaces all missing values and transforms nominal attributes into binary ones. It also normalizes all attributes by default. (In that case the coefficients in the output are based on the normalized data, not the original data --- this is important for interpreting the classifier.)

Multi-class problems are solved using pairwise classification (1-vs-1 and if logistic models are built pairwise coupling according to Hastie and Tibshirani, 1998).

To obtain proper probability estimates, use the option that fits logistic regression models to the outputs of the support vector machine. In the multi-class case the predicted probabilities are coupled using Hastie and Tibshirani's pairwise coupling method.

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

For more information on the SMO algorithm, see

J. Platt: Fast Training of Support Vector Machines using Sequential Minimal Optimization. In B. Schoelkopf and C. Burges and A. Smola, editors, Advances in Kernel Methods - Support Vector Learning, 1998.

S.S. Keerthi, S.K. Shevade, C. Bhattacharyya, K.R.K. Murthy (2001). Improvements to Platt's SMO Algorithm for SVM Classifier Design. Neural Computation. 13(3):637-649.

Trevor Hastie, Robert Tibshirani: Classification by Pairwise Coupling. In: Advances in Neural Information Processing Systems, 1998.

BibTeX:

 @incollection{Platt1998,
    author = {J. Platt},
    booktitle = {Advances in Kernel Methods - Support Vector Learning},
    editor = {B. Schoelkopf and C. Burges and A. Smola},
    publisher = {MIT Press},
    title = {Fast Training of Support Vector Machines using Sequential Minimal Optimization},
    year = {1998},
    URL = {http://research.microsoft.com/\~jplatt/smo.html},
    PS = {http://research.microsoft.com/\~jplatt/smo-book.ps.gz},
    PDF = {http://research.microsoft.com/\~jplatt/smo-book.pdf}
 }
 
 @article{Keerthi2001,
    author = {S.S. Keerthi and S.K. Shevade and C. Bhattacharyya and K.R.K. Murthy},
    journal = {Neural Computation},
    number = {3},
    pages = {637-649},
    title = {Improvements to Platt's SMO Algorithm for SVM Classifier Design},
    volume = {13},
    year = {2001},
    PS = {http://guppy.mpe.nus.edu.sg/\~mpessk/svm/smo_mod_nc.ps.gz}
 }
 
 @inproceedings{Hastie1998,
    author = {Trevor Hastie and Robert Tibshirani},
    booktitle = {Advances in Neural Information Processing Systems},
    editor = {Michael I. Jordan and Michael J. Kearns and Sara A. Solla},
    publisher = {MIT Press},
    title = {Classification by Pairwise Coupling},
    volume = {10},
    year = {1998},
    PS = {http://www-stat.stanford.edu/\~hastie/Papers/2class.ps}
 }
 

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)
 -C <double>
  The complexity constant C. (default 1)
 -N
  Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
 -L <double>
  The tolerance parameter. (default 1.0e-3)
 -P <double>
  The epsilon for round-off error. (default 1.0e-12)
 -M
  Fit logistic models to SVM outputs. 
 -V <double>
  The number of folds for the internal
  cross-validation. (default -1, use training data)
 -W <double>
  The random number seed. (default 1)
 -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)
版本:
$Revision: 6025 $
作者:
Eibe Frank (eibe@cs.waikato.ac.nz), Shane Legg (shane@intelligenesis.net) (sparse vector code), Stuart Inglis (stuart@reeltwo.com) (sparse vector code)
另请参阅:
  • 字段详细资料

    • FILTER_NORMALIZE

      public static final int FILTER_NORMALIZE
      filter: Normalize training data
      另请参阅:
    • FILTER_STANDARDIZE

      public static final int FILTER_STANDARDIZE
      filter: Standardize training data
      另请参阅:
    • FILTER_NONE

      public static final int FILTER_NONE
      filter: No normalization/standardization
      另请参阅:
    • TAGS_FILTER

      public static final Tag[] TAGS_FILTER
      The filter to apply to the training data
  • 构造器详细资料

    • SMO

      public SMO()
  • 方法详细资料

    • globalInfo

      public String globalInfo()
      Returns a string describing classifier
      返回:
      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.
      指定者:
      getTechnicalInformation 在接口中 TechnicalInformationHandler
      返回:
      the technical information about this class
    • 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.
    • getCapabilities

      public Capabilities getCapabilities()
      Returns default capabilities of the classifier.
      指定者:
      getCapabilities 在接口中 CapabilitiesHandler
      覆盖:
      getCapabilities 在类中 Classifier
      返回:
      the capabilities of this classifier
      另请参阅:
    • buildClassifier

      public void buildClassifier(Instances insts) throws Exception
      Method for building the classifier. Implements a one-against-one wrapper for multi-class problems.
      指定者:
      buildClassifier 在类中 Classifier
      参数:
      insts - the set of training instances
      抛出:
      Exception - if the classifier can't be built successfully
    • distributionForInstance

      public double[] distributionForInstance(Instance inst) throws Exception
      Estimates class probabilities for given instance.
      覆盖:
      distributionForInstance 在类中 Classifier
      参数:
      inst - the instance to compute the probabilities for
      返回:
      an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
      抛出:
      Exception - in case of an error
    • obtainVotes

      public int[] obtainVotes(Instance inst) throws Exception
      Returns an array of votes for the given instance.
      参数:
      inst - the instance
      返回:
      array of votex
      抛出:
      Exception - if something goes wrong
    • sparseWeights

      public double[][][] sparseWeights()
      Returns the weights in sparse format.
    • sparseIndices

      public int[][][] sparseIndices()
      Returns the indices in sparse format.
    • bias

      public double[][] bias()
      Returns the bias of each binary SMO.
    • numClassAttributeValues

      public int numClassAttributeValues()
    • classAttributeNames

      public String[] classAttributeNames()
    • attributeNames

      public String[][][] attributeNames()
      Returns the attribute names.
    • listOptions

      public Enumeration listOptions()
      Returns an enumeration describing the available options.
      指定者:
      listOptions 在接口中 OptionHandler
      覆盖:
      listOptions 在类中 Classifier
      返回:
      an enumeration of all the available options.
    • setOptions

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

      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)
       -C <double>
        The complexity constant C. (default 1)
       -N
        Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
       -L <double>
        The tolerance parameter. (default 1.0e-3)
       -P <double>
        The epsilon for round-off error. (default 1.0e-12)
       -M
        Fit logistic models to SVM outputs. 
       -V <double>
        The number of folds for the internal
        cross-validation. (default -1, use training data)
       -W <double>
        The random number seed. (default 1)
       -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)
      指定者:
      setOptions 在接口中 OptionHandler
      覆盖:
      setOptions 在类中 Classifier
      参数:
      options - the list of options as an array of strings
      抛出:
      Exception - if an option is not supported
    • getOptions

      public String[] getOptions()
      Gets the current settings of the classifier.
      指定者:
      getOptions 在接口中 OptionHandler
      覆盖:
      getOptions 在类中 Classifier
      返回:
      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!
      参数:
      value - if true turns off all checks
    • getChecksTurnedOff

      public boolean getChecksTurnedOff()
      Returns whether the checks are turned off or not.
      返回:
      true if the checks are turned off
    • checksTurnedOffTipText

      public String checksTurnedOffTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • kernelTipText

      public String kernelTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • setKernel

      public void setKernel(Kernel value)
      sets the kernel to use
      参数:
      value - the kernel to use
    • getKernel

      public Kernel getKernel()
      Returns the kernel to use
      返回:
      the current kernel
    • cTipText

      public String cTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getC

      public double getC()
      Get the value of C.
      返回:
      Value of C.
    • setC

      public void setC(double v)
      Set the value of C.
      参数:
      v - Value to assign to C.
    • toleranceParameterTipText

      public String toleranceParameterTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getToleranceParameter

      public double getToleranceParameter()
      Get the value of tolerance parameter.
      返回:
      Value of tolerance parameter.
    • setToleranceParameter

      public void setToleranceParameter(double v)
      Set the value of tolerance parameter.
      参数:
      v - Value to assign to tolerance parameter.
    • epsilonTipText

      public String epsilonTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getEpsilon

      public double getEpsilon()
      Get the value of epsilon.
      返回:
      Value of epsilon.
    • setEpsilon

      public void setEpsilon(double v)
      Set the value of epsilon.
      参数:
      v - Value to assign to epsilon.
    • filterTypeTipText

      public String filterTypeTipText()
      Returns the tip text for this property
      返回:
      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.
      返回:
      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.
      参数:
      newType - the new filtering mode
    • buildLogisticModelsTipText

      public String buildLogisticModelsTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getBuildLogisticModels

      public boolean getBuildLogisticModels()
      Get the value of buildLogisticModels.
      返回:
      Value of buildLogisticModels.
    • setBuildLogisticModels

      public void setBuildLogisticModels(boolean newbuildLogisticModels)
      Set the value of buildLogisticModels.
      参数:
      newbuildLogisticModels - Value to assign to buildLogisticModels.
    • numFoldsTipText

      public String numFoldsTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getNumFolds

      public int getNumFolds()
      Get the value of numFolds.
      返回:
      Value of numFolds.
    • setNumFolds

      public void setNumFolds(int newnumFolds)
      Set the value of numFolds.
      参数:
      newnumFolds - Value to assign to numFolds.
    • randomSeedTipText

      public String randomSeedTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getRandomSeed

      public int getRandomSeed()
      Get the value of randomSeed.
      返回:
      Value of randomSeed.
    • setRandomSeed

      public void setRandomSeed(int newrandomSeed)
      Set the value of randomSeed.
      参数:
      newrandomSeed - Value to assign to randomSeed.
    • toString

      public String toString()
      Prints out the classifier.
      覆盖:
      toString 在类中 Object
      返回:
      a description of the classifier as a string
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      覆盖:
      getRevision 在类中 Classifier
      返回:
      the revision
    • main

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