Package weka.classifiers.functions
Class LeastMedSq
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.functions.LeastMedSq
- All Implemented Interfaces:
Serializable,Cloneable,CapabilitiesHandler,OptionHandler,RevisionHandler,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:
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: 5523 $
- Author:
- Tony Voyle (tv6@waikato.ac.nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildClassifier(Instances data) Build lms regressiondoubleclassifyInstance(Instance instance) Classify a given instance using the best generated LinearRegression Classifier.static intcombinations(int n, int r) Produces the combination nCrReturns default capabilities of the classifier.booleangetDebug()Returns whether or not debugging output shouild be printedString[]Gets the current option settings for the OptionHandler.longget the seed for the random number generatorReturns the revision string.intgets number of samplesReturns 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.Returns a string describing this classifierReturns an enumeration of all the available options..static voidgenerate a Linear regression predictor for testingReturns the tip text for this propertyReturns the tip text for this propertyvoidsetDebug(boolean debug) sets whether or not debugging output shouild be printedvoidsetOptions(String[] options) Sets the OptionHandler's options using the given list.voidsetRandomSeed(long randomseed) Set the seed for the random number generatorvoidsetSampleSize(int samplesize) sets number of samplestoString()Returns a string representing the best LinearRegression classifier found.Methods inherited from class weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, makeCopies, makeCopy
-
Constructor Details
-
LeastMedSq
public LeastMedSq()
-
-
Method Details
-
globalInfo
Returns a string describing this classifier- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
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:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classClassifier- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Build lms regression- Specified by:
buildClassifierin classClassifier- Parameters:
data- training data- Throws:
Exception- if an error occurs
-
classifyInstance
Classify a given instance using the best generated LinearRegression Classifier.- Overrides:
classifyInstancein classClassifier- Parameters:
instance- instance to be classified- Returns:
- class value
- Throws:
Exception- if an error occurs
-
toString
Returns a string representing the best LinearRegression classifier found. -
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
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:
setDebugin classClassifier- Parameters:
debug- true if debugging output selected
-
getDebug
public boolean getDebug()Returns whether or not debugging output shouild be printed- Overrides:
getDebugin classClassifier- Returns:
- true if debuging output selected
-
listOptions
Returns an enumeration of all the available options..- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassifier- Returns:
- an enumeration of all available options.
-
setOptions
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:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassifier- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
Gets the current option settings for the OptionHandler.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClassifier- Returns:
- the list of current option settings as an array of strings
-
combinations
Produces the combination nCr- Parameters:
n-r-- Returns:
- the combination
- Throws:
Exception- if r is greater than n
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
generate a Linear regression predictor for testing- Parameters:
argv- options
-