public class LWL extends SingleClassifierEnhancer implements UpdateableClassifier, WeightedInstancesHandler, TechnicalInformationHandler
@inproceedings{Frank2003,
author = {Eibe Frank and Mark Hall and Bernhard Pfahringer},
booktitle = {19th Conference in Uncertainty in Artificial Intelligence},
pages = {249-256},
publisher = {Morgan Kaufmann},
title = {Locally Weighted Naive Bayes},
year = {2003}
}
@article{Atkeson1996,
author = {C. Atkeson and A. Moore and S. Schaal},
journal = {AI Review},
title = {Locally weighted learning},
year = {1996}
}
Valid options are:
-A The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
-K <number of neighbours> Set the number of neighbours used to set the kernel bandwidth. (default all)
-U <number of weighting method> Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov, 2=Tricube, 3=Inverse, 4=Gaussian. (default 0 = Linear)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.DecisionStump)
Options specific to classifier weka.classifiers.trees.DecisionStump:
-D If set, classifier is run in debug mode and may output additional info to the console
| Constructor and Description |
|---|
LWL()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(Instances instances)
Generates the classifier.
|
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test instance.
|
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names
produced by the neighbour search algorithm.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
int |
getKNN()
Gets the number of neighbours used for kernel bandwidth setting.
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure from the
neighbour search algorithm.
|
NearestNeighbourSearch |
getNearestNeighbourSearchAlgorithm()
Returns the current nearestNeighbourSearch algorithm in use.
|
java.lang.String[] |
getOptions()
Gets the current settings of the classifier.
|
java.lang.String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
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.
|
java.lang.String |
nearestNeighbourSearchAlgorithmTipText()
Returns the tip text for this property.
|
void |
setKNN(int knn)
Sets the number of neighbours used for kernel bandwidth setting.
|
void |
setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm)
Sets the nearestNeighbourSearch algorithm to be used for finding nearest
neighbour(s).
|
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.
|
classifierTipText, getClassifier, setClassifierclassifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebugpublic java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic java.util.Enumeration enumerateMeasures()
public double getMeasure(java.lang.String additionalMeasureName)
additionalMeasureName - the name of the measure to query for its valuejava.lang.IllegalArgumentException - if the named measure is not supportedpublic java.util.Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class SingleClassifierEnhancerpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-A The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
-K <number of neighbours> Set the number of neighbours used to set the kernel bandwidth. (default all)
-U <number of weighting method> Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov, 2=Tricube, 3=Inverse, 4=Gaussian. (default 0 = Linear)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.DecisionStump)
Options specific to classifier weka.classifiers.trees.DecisionStump:
-D If set, classifier is run in debug mode and may output additional info to the console
setOptions in interface OptionHandlersetOptions in class SingleClassifierEnhanceroptions - the list of options as an array of stringsjava.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 nearestNeighbourSearchAlgorithmTipText()
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm()
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm)
nearestNeighbourSearchAlgorithm - - The NearestNeighbourSearch class.public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class SingleClassifierEnhancerCapabilitiespublic void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier in class Classifierinstances - 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 UpdateableClassifierinstance - the instance to addjava.lang.Exception - if instance could not be incorporated
successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance in class Classifierinstance - the instance to be classifiedjava.lang.Exception - if distribution can't be computed successfullypublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Classifierpublic static void main(java.lang.String[] argv)
argv - the options