|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.LWR
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)
Field Summary | |
protected static int |
GAUSS
|
protected static int |
INVERSE
|
protected static int |
LINEAR
|
protected boolean |
m_Debug
True if debugging output should be printed |
protected int |
m_kNN
The number of neighbours used to select the kernel bandwidth |
protected double[] |
m_Max
The maximum values for numeric attributes. |
protected double[] |
m_Min
The minimum values for numeric attributes. |
protected Instances |
m_Train
The training instances used for classification. |
protected boolean |
m_UseAllK
True if m_kNN should be set to all instances |
protected int |
m_WeightKernel
The weighting kernel method currently selected |
Constructor Summary | |
LWR()
|
Method Summary | |
void |
buildClassifier(Instances instances)
Generates the classifier. |
double |
classifyInstance(Instance instance)
Predicts the class value for the given test instance. |
protected double |
getAttributeMax(int index)
Gets an attributes maximum observed value |
protected double |
getAttributeMin(int index)
Gets an attributes minimum observed value |
boolean |
getDebug()
SGts whether debugging output should be produced |
int |
getKNN()
Gets the number of neighbours used for kernel bandwidth setting. |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
int |
getWeightingKernel()
Gets the kernel weighting method to use. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
void |
setDebug(boolean debug)
Sets whether debugging output should be produced |
void |
setKNN(int knn)
Sets the number of neighbours used for kernel bandwidth setting. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setWeightingKernel(int kernel)
Sets the kernel weighting method to use. |
java.lang.String |
toString()
Returns a description of this classifier. |
void |
updateClassifier(Instance instance)
Adds the supplied instance to the training set |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Instances m_Train
protected double[] m_Min
protected double[] m_Max
protected boolean m_Debug
protected int m_kNN
protected int m_WeightKernel
protected boolean m_UseAllK
protected static final int LINEAR
protected static final int INVERSE
protected static final int GAUSS
Constructor Detail |
public LWR()
Method Detail |
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-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)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setDebug(boolean debug)
debug
- true if debugging output should be printedpublic boolean getDebug()
public void setKNN(int knn)
knn
- the number of neighbours included inside the kernel
bandwidth, or 0 to specify using all neighbors.public int getKNN()
public void setWeightingKernel(int kernel)
kernel
- the new kernel method to use. Must be one of LINEAR,
INVERSE, or GAUSSpublic int getWeightingKernel()
protected double getAttributeMin(int index)
index
- the index of the attributeprotected double getAttributeMax(int index)
index
- the index of the attributepublic void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training datajava.lang.Exception
- if the classifier has not been generated successfullypublic void updateClassifier(Instance instance) throws java.lang.Exception
updateClassifier
in interface UpdateableClassifier
instance
- the instance to addjava.lang.Exception
- if instance could not be incorporated
successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the instance to be classifiedjava.lang.Exception
- if an error occurred during the predictionpublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- the options
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |