LeastMedSq

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.functions
Class LeastMedSq

    java.lang.Object
      weka.classifiers.Classifier
          weka.classifiers.functions.LeastMedSq

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler

    public class LeastMedSq

extends Classifier
implements OptionHandler, TechnicalInformationHandler

Implements a least median sqaured linear regression utilising the existing weka LinearRegression class to form predictions.
Least squared regression functions are generated from random subsamples of the data. The least squared regression with the lowest meadian squared error is chosen as the final model.
The basis of the algorithm is
Peter J. Rousseeuw, Annick M. Leroy (1987). Robust regression and outlier detection. .

BibTeX:

     @book{Rousseeuw1987,
        author = {Peter J. Rousseeuw and Annick M. Leroy},
        title = {Robust regression and outlier detection},
        year = {1987}
     }

Valid options are:

     -S <sample size>
      Set sample size
      (default: 4)

     -G <seed>
      Set the seed used to generate samples
      (default: 0)

     -D
      Produce debugging output
      (default no debugging output)

Version:
  $Revision: 1.17 $
Author:
  Tony Voyle (tv6@waikato.ac.nz)
See Also:
  Serialized Form

Constructor Summary
`LeastMedSq()`

Method Summary
`void` | `buildClassifier(Instances data)` Build lms regression
`double` | `classifyInstance(Instance instance)` Classify a given instance using the best generated LinearRegression Classifier.
`static int` | `combinations(int n, int r)` Produces the combination nCr
`Capabilities` | `getCapabilities()` Returns default capabilities of the classifier.
`boolean` | `getDebug()` Returns whether or not debugging output shouild be printed
`java.lang.String[]` | `getOptions()` Gets the current option settings for the OptionHandler.
`long` | `getRandomSeed()` get the seed for the random number generator
`java.lang.String` | `getRevision()` Returns the revision string.
`int` | `getSampleSize()` gets number of samples
`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.
`java.lang.String` | `globalInfo()` Returns a string describing this classifier
`java.util.Enumeration` | `listOptions()` Returns an enumeration of all the available options..
`static void` | `main(java.lang.String[] argv)` generate a Linear regression predictor for testing
`java.lang.String` | `randomSeedTipText()` Returns the tip text for this property
`java.lang.String` | `sampleSizeTipText()` Returns the tip text for this property
`void` | `setDebug(boolean debug)` sets whether or not debugging output shouild be printed
`void` | `setOptions(java.lang.String[] options)` Sets the OptionHandler's options using the given list.
`void` | `setRandomSeed(long randomseed)` Set the seed for the random number generator
`void` | `setSampleSize(int samplesize)` sets number of samples
`java.lang.String` | `toString()` Returns a string representing the best LinearRegression classifier found.

Methods inherited from class weka.classifiers.Classifier
`debugTipText, distributionForInstance, forName, makeCopies, makeCopy`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LeastMedSq

    public LeastMedSq()

Method Detail

### globalInfo

    public java.lang.String globalInfo()

  Returns a string describing this classifier

  Returns:
    a description of the classifier 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 data)
                         throws java.lang.Exception

  Build lms regression

  Specified by:
    `buildClassifier` in class `Classifier`
  Parameters:
    `data` - training data
  Throws:
    `java.lang.Exception` - if an error occurs

### classifyInstance

    public double classifyInstance(Instance instance)
                            throws java.lang.Exception

  Classify a given instance using the best generated LinearRegression Classifier.

  Overrides:
    `classifyInstance` in class `Classifier`
  Parameters:
    `instance` - instance to be classified
  Returns:
    class value
  Throws:
    `java.lang.Exception` - if an error occurs

### toString

    public java.lang.String toString()

  Returns a string representing the best LinearRegression classifier found.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    String representing the regression

### sampleSizeTipText

    public java.lang.String sampleSizeTipText()

  Returns the tip text for this property

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

### setSampleSize

    public void setSampleSize(int samplesize)

  sets number of samples

  Parameters:
    `samplesize` - value

### getSampleSize

    public int getSampleSize()

  gets number of samples

  Returns:
    value

### randomSeedTipText

    public java.lang.String randomSeedTipText()

  Returns the tip text for this property

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

### setRandomSeed

    public void setRandomSeed(long randomseed)

  Set the seed for the random number generator

  Parameters:
    `randomseed` - the seed

### getRandomSeed

    public long getRandomSeed()

  get the seed for the random number generator

  Returns:
    the seed value

### setDebug

    public void setDebug(boolean debug)

  sets whether or not debugging output shouild be printed

  Overrides:
    `setDebug` in class `Classifier`
  Parameters:
    `debug` - true if debugging output selected

### getDebug

    public boolean getDebug()

  Returns whether or not debugging output shouild be printed

  Overrides:
    `getDebug` in class `Classifier`
  Returns:
    true if debuging output selected

### listOptions

    public java.util.Enumeration listOptions()

  Returns an enumeration of all the available options..

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

### setOptions

    public void setOptions(java.lang.String[] options)
                    throws java.lang.Exception

  Sets the OptionHandler's options using the given list. All options will be set (or reset) during this call (i.e. incremental setting of options is not possible). Valid options are:

       -S <sample size>
        Set sample size
        (default: 4)

       -G <seed>
        Set the seed used to generate samples
        (default: 0)

       -D
        Produce debugging output
        (default no debugging output)

  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 option settings for the OptionHandler.

  Specified by:
    `getOptions` in interface `OptionHandler`
  Overrides:
    `getOptions` in class `Classifier`
  Returns:
    the list of current option settings as an array of strings

### combinations

    public static int combinations(int n,
                                   int r)
                            throws java.lang.Exception

  Produces the combination nCr

  Parameters:
    `n` -
    `r` -
  Returns:
    the combination
  Throws:
    `java.lang.Exception` - if r is greater than n

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Returns:
    the revision

### main

    public static void main(java.lang.String[] argv)

  generate a Linear regression predictor for testing

  Parameters:
    `argv` - options

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD