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

Class weka.classifiers.LWR

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.LWR

public class LWR
extends Classifier
implements OptionHandler, UpdateableClassifier, WeightedInstancesHandler
Locally-weighted regression. Uses an instance-based algorithm to assign instance weights which are then used by a linear regression model. For more information, see

Atkeson, C., A. Moore, and S. Schaal (1996) Locally weighted learning download postscript.

Valid options are:

-D
Produce debugging output.

-K num
Set the number of neighbours used for setting kernel bandwidth. (default all)

-W num
Set the weighting kernel shape to use. 1 = Inverse, 2 = Gaussian. (default 0 = Linear)

Version:
$Revision: 1.9 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz)

Constructor Index

 o LWR()
 

Method Index

 o buildClassifier(Instances)
Generates the classifier.
 o classifyInstance(Instance)
Predicts the class value for the given test instance.
 o getDebug()
SGts whether debugging output should be produced
 o getKNN()
Gets the number of neighbours used for kernel bandwidth setting.
 o getOptions()
Gets the current settings of the classifier.
 o getWeightingKernel()
Gets the kernel weighting method to use.
 o listOptions()
Returns an enumeration describing the available options
 o main(String[])
Main method for testing this class.
 o setDebug(boolean)
Sets whether debugging output should be produced
 o setKNN(int)
Sets the number of neighbours used for kernel bandwidth setting.
 o setOptions(String[])
Parses a given list of options.
 o setWeightingKernel(int)
Sets the kernel weighting method to use.
 o toString()
Returns a description of this classifier.
 o updateClassifier(Instance)
Adds the supplied instance to the training set

Constructor Detail

 o LWR
public LWR()

Method Detail

 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
Returns:
an enumeration of all the available options
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options. Valid options are:

-D
Produce debugging output.

-K num
Set the number of neighbours used for setting kernel bandwidth. (default all)

-W num
Set the weighting kernel shape to use. 1 = Inverse, 2 = Gaussian. (default 0 = Linear)

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 settings of the classifier.
Returns:
an array of strings suitable for passing to setOptions
 o setDebug
public void setDebug(boolean debug)
          Sets whether debugging output should be produced
Parameters:
debug - true if debugging output should be printed
 o getDebug
public boolean getDebug()
          SGts whether debugging output should be produced
Returns:
true if debugging output should be printed
 o setKNN
public void setKNN(int knn)
          Sets the number of neighbours used for kernel bandwidth setting. The bandwidth is taken as the distance to the kth neighbour.
Parameters:
knn - the number of neighbours included inside the kernel bandwidth, or 0 to specify using all neighbors.
 o getKNN
public int getKNN()
          Gets the number of neighbours used for kernel bandwidth setting. The bandwidth is taken as the distance to the kth neighbour.
Returns:
the number of neighbours included inside the kernel bandwidth, or 0 for all neighbours
 o setWeightingKernel
public void setWeightingKernel(int kernel)
          Sets the kernel weighting method to use. Must be one of LINEAR, INVERSE, or GAUSS, other values are ignored.
Parameters:
kernel - the new kernel method to use. Must be one of LINEAR, INVERSE, or GAUSS
 o getWeightingKernel
public int getWeightingKernel()
          Gets the kernel weighting method to use.
Returns:
the new kernel method to use. Will be one of LINEAR, INVERSE, or GAUSS
 o buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
          Generates the classifier.
Parameters:
instances - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully
Overrides:
buildClassifier in class Classifier
 o updateClassifier
public void updateClassifier(Instance instance) throws java.lang.Exception
          Adds the supplied instance to the training set
Parameters:
instance - the instance to add
Throws:
java.lang.Exception - if instance could not be incorporated successfully
 o classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
          Predicts the class value for the given test instance.
Parameters:
instance - the instance to be classified
Returns:
the predicted class value
Throws:
java.lang.Exception - if an error occurred during the prediction
Overrides:
classifyInstance in class Classifier
 o toString
public java.lang.String toString()
          Returns a description of this classifier.
Returns:
a description of this classifier as a string.
Overrides:
toString in class java.lang.Object
 o main
public static void main(java.lang.String argv[])
          Main method for testing this class.
Parameters:
argv - the options

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