|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.SingleClassifierEnhancer
weka.classifiers.lazy.LWL
Locally-weighted learning. Uses an instance-based algorithm to assign instance weights which are then used by a specified WeightedInstancesHandler. A good choice for classification is NaiveBayes. LinearRegression is suitable for regression problems. For more information, see
Eibe Frank, Mark Hall, and Bernhard Pfahringer (2003). Locally Weighted Naive Bayes. Working Paper 04/03, Department of Computer Science, University of Waikato. Atkeson, C., A. Moore, and S. Schaal (1996) Locally weighted learning download postscript.
Valid options are:
-D
Produce debugging output.
-N
Do not normalize numeric attributes' values in distance calculation.
-K num
Set the number of neighbours used for setting kernel bandwidth.
(default all)
-U num
Set the weighting kernel shape to use. 0 = Linear, 1 = Epnechnikov,
2 = Tricube, 3 = Inverse, 4 = Gaussian and 5 = Constant.
(default 0 = Linear)
-W classname
Specify the full class name of a base classifier (which needs
to be a WeightedInstancesHandler).
| Constructor Summary | |
LWL()
Constructor. |
|
| Method Summary | |
void |
buildClassifier(Instances instances)
Generates the classifier. |
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test instance. |
java.lang.String |
dontNormalizeTipText()
Returns the tip text for this property |
boolean |
getDontNormalize()
Gets whether if the numeric attribute values are not to be normalized for calculating the distances. |
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.lang.String |
globalInfo()
Returns a string describing classifier |
java.lang.String |
KNNTipText()
Returns the tip text for this property |
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 |
setDontNormalize(boolean normalize)
Sets whether if the numeric attribute values are not to be normalized for calculating the distances between them. |
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 |
java.lang.String |
weightingKernelTipText()
Returns the tip text for this property |
| Methods inherited from class weka.classifiers.SingleClassifierEnhancer |
classifierTipText, getClassifier, setClassifier |
| Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public LWL()
| Method Detail |
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class SingleClassifierEnhancer
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
-D
Produce debugging output.
-N
Do not normalize numeric attributes' values in distance calculation.
(default DO normalization)
-K num
Set the number of neighbours used for setting kernel bandwidth.
(default all)
-U num
Set the weighting kernel shape to use. 0 = Linear, 1 = Epnechnikov,
2 = Tricube, 3 = Inverse, 4 = Gaussian and 5 = Constant.
(default 0 = Linear)
-W classname
Specify the full class name of a base classifier (which needs
to be a WeightedInstancesHandler).
setOptions in interface OptionHandlersetOptions in class SingleClassifierEnhanceroptions - the list of options as an array of strings
java.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SingleClassifierEnhancerpublic java.lang.String KNNTipText()
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 java.lang.String weightingKernelTipText()
public void setWeightingKernel(int kernel)
kernel - the new kernel method to use. Must be one of LINEAR,
EPANECHNIKOV, TRICUBE, INVERSE, GAUSS or CONSTANT.public int getWeightingKernel()
public java.lang.String dontNormalizeTipText()
public boolean getDontNormalize()
public void setDontNormalize(boolean normalize)
public void buildClassifier(Instances instances)
throws java.lang.Exception
buildClassifier in class Classifierinstances - set of instances serving as training data
java.lang.Exception - if the classifier has not been generated successfully
public void updateClassifier(Instance instance)
throws java.lang.Exception
updateClassifier in interface UpdateableClassifierinstance - the instance to add
java.lang.Exception - if instance could not be incorporated
successfully
public double[] distributionForInstance(Instance instance)
throws java.lang.Exception
distributionForInstance in class Classifierinstance - the instance to be classified
java.lang.Exception - if distribution can't be computed successfullypublic java.lang.String toString()
public static void main(java.lang.String[] argv)
argv - the options
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||