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.6 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
-
LWR()
-
-
buildClassifier(Instances)
- Generates the classifier.
-
classifyInstance(Instance)
- Predicts the class value for the given test instance.
-
getDebug()
- SGts whether debugging output should be produced
-
getKNN()
- Gets the number of neighbours used for kernel bandwidth setting.
-
getOptions()
- Gets the current settings of the classifier.
-
getWeightingKernel()
- Gets the kernel weighting method to use.
-
listOptions()
- Returns an enumeration describing the available options
-
main(String[])
- Main method for testing this class.
-
setDebug(boolean)
- Sets whether debugging output should be produced
-
setKNN(int)
- Sets the number of neighbours used for kernel bandwidth setting.
-
setOptions(String[])
- Parses a given list of options.
-
setWeightingKernel(int)
- Sets the kernel weighting method to use.
-
toString()
- Returns a description of this classifier.
-
updateClassifier(Instance)
- Adds the supplied instance to the training set
LWR
public LWR()
listOptions
public Enumeration listOptions()
- Returns an enumeration describing the available options
- Returns:
- 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
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: Exception
- if an option is not supported
getOptions
public String[] getOptions()
- Gets the current settings of the classifier.
- Returns:
- an array of strings suitable for passing to setOptions
setDebug
public void setDebug(boolean debug)
- Sets whether debugging output should be produced
- Parameters:
- debug - true if debugging output should be printed
getDebug
public boolean getDebug()
- SGts whether debugging output should be produced
- Returns:
- true if debugging output should be printed
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.
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
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
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
buildClassifier
public void buildClassifier(Instances instances) throws Exception
- Generates the classifier.
- Parameters:
- instances - set of instances serving as training data
- Throws: Exception
- if the classifier has not been generated successfully
- Overrides:
- buildClassifier in class Classifier
updateClassifier
public void updateClassifier(Instance instance) throws Exception
- Adds the supplied instance to the training set
- Parameters:
- instance - the instance to add
- Throws: Exception
- if instance could not be incorporated
successfully
classifyInstance
public double classifyInstance(Instance instance) throws Exception
- Predicts the class value for the given test instance.
- Parameters:
- instance - the instance to be classified
- Returns:
- the predicted class value
- Throws: Exception
- if an error occurred during the prediction
- Overrides:
- classifyInstance in class Classifier
toString
public String toString()
- Returns a description of this classifier.
- Returns:
- a description of this classifier as a string.
- Overrides:
- toString in class Object
main
public static void main(String argv[])
- Main method for testing this class.
- Parameters:
- argv - the options
All Packages Class Hierarchy This Package Previous Next Index WEKA's home