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

Class weka.classifiers.functions.LeastMedSq

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.functions.LeastMedSq

public class LeastMedSq
extends Classifier
implements OptionHandler
Implements a least median sqaured linear regression utilising the existing weka LinearRegression class to form predictions. The basis of the algorithm is Robust regression and outlier detection Peter J. Rousseeuw, Annick M. Leroy. c1987

Version:
$Revision: 1.7 $
Author:
Tony Voyle (tv6@waikato.ac.nz)

Constructor Index

 o LeastMedSq()
 

Method Index

 o buildClassifier(Instances)
Build lms regression
 o classifyInstance(Instance)
Classify a given instance using the best generated LinearRegression Classifier.
 o combinations(int, int)
Produces the combination nCr
 o getDebug()
Returns whether or not debugging output shouild be printed
 o getIsRandom()
Returns whether or not samples are selected randomly
 o getOptions()
Gets the current option settings for the OptionHandler.
 o getRandomSeed()
get the seed for the random number generator
 o getSampleSize()
gets number of samples
 o listOptions()
Returns an enumeration of all the available options..
 o main(String[])
generate a Linear regression predictor for testing
 o setDebug(boolean)
sets whether or not debugging output shouild be printed
 o setIsRandom(boolean)
Sets whether sample selection is random
 o setOptions(String[])
Sets the OptionHandler's options using the given list.
 o setRandomSeed(long)
Set the seed for the random number generator
 o setSampleSize(int)
sets number of samples
 o toString()
Returns a string representing the best LinearRegression classifier found.

Constructor Detail

 o LeastMedSq
public LeastMedSq()

Method Detail

 o buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
          Build lms regression
Parameters:
data - training data
Throws:
java.lang.Exception - if an error occurs
Overrides:
buildClassifier in class Classifier
 o classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
          Classify a given instance using the best generated LinearRegression Classifier.
Parameters:
instance - instance to be classified
Returns:
class value
Throws:
java.lang.Exception - if an error occurs
Overrides:
classifyInstance in class Classifier
 o toString
public java.lang.String toString()
          Returns a string representing the best LinearRegression classifier found.
Returns:
String representing the regression
Overrides:
toString in class java.lang.Object
 o setSampleSize
public void setSampleSize(int samplesize)
          sets number of samples
Parameters:
samplesize - value
 o getSampleSize
public int getSampleSize()
          gets number of samples
Returns:
value
 o setIsRandom
public void setIsRandom(boolean israndom)
          Sets whether sample selection is random
Parameters:
israndom - true if sample selection is random
 o getIsRandom
public boolean getIsRandom()
          Returns whether or not samples are selected randomly
Returns:
true if sample selection is random
 o setRandomSeed
public void setRandomSeed(long randomseed)
          Set the seed for the random number generator
Parameters:
randomseed - the seed
 o getRandomSeed
public long getRandomSeed()
          get the seed for the random number generator
Returns:
the seed value
 o setDebug
public void setDebug(boolean debug)
          sets whether or not debugging output shouild be printed
Parameters:
debug - true if debugging output selected
 o getDebug
public boolean getDebug()
          Returns whether or not debugging output shouild be printed
Returns:
true if debuging output selected
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration of all the available options..
Returns:
an enumeration of all available options.
 o 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).
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o getOptions
public java.lang.String[] getOptions()
          Gets the current option settings for the OptionHandler.
Returns:
the list of current option settings as an array of strings
 o combinations
public static int combinations(int n,
                               int r) throws java.lang.Exception
          Produces the combination nCr
Parameters:
n -
n -
Returns:
the combination
Throws:
java.lang.Exception - if r is greater than n
 o main
public static void main(java.lang.String argv[])
          generate a Linear regression predictor for testing
Parameters:
argv - options

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