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
| Modifier and Type | Field and Description |
|---|---|
static int |
CONSTANT |
static int |
EPANECHNIKOV |
static int |
GAUSS |
static int |
INVERSE |
static int |
LINEAR
The available kernel weighting methods.
|
static int |
TRICUBE |
| 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.
|
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(String additionalMeasureName)
Returns the value of the named measure from the
neighbour search algorithm.
|
NearestNeighbourSearch |
getNearestNeighbourSearchAlgorithm()
Returns the current nearestNeighbourSearch algorithm in use.
|
String[] |
getOptions()
Gets the current settings of the classifier.
|
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.
|
String |
globalInfo()
Returns a string describing classifier.
|
String |
KNNTipText()
Returns the tip text for this property.
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class.
|
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(String[] options)
Parses a given list of options.
|
void |
setWeightingKernel(int kernel)
Sets the kernel weighting method to use.
|
String |
toString()
Returns a description of this classifier.
|
void |
updateClassifier(Instance instance)
Adds the supplied instance to the training set.
|
String |
weightingKernelTipText()
Returns the tip text for this property.
|
classifierTipText, getClassifier, setClassifierclassifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebugpublic static final int LINEAR
public static final int EPANECHNIKOV
public static final int TRICUBE
public static final int INVERSE
public static final int GAUSS
public static final int CONSTANT
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic Enumeration enumerateMeasures()
public double getMeasure(String additionalMeasureName)
additionalMeasureName - the name of the measure to query for its valueIllegalArgumentException - if the named measure is not supportedpublic Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class SingleClassifierEnhancerpublic void setOptions(String[] options) throws 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 stringsException - if an option is not supportedpublic String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SingleClassifierEnhancerpublic 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 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 String nearestNeighbourSearchAlgorithmTipText()
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm()
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm)
nearestNeighbourSearchAlgorithm - - The NearestNeighbourSearch class.public Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class SingleClassifierEnhancerCapabilitiespublic void buildClassifier(Instances instances) throws Exception
buildClassifier in interface Classifierinstances - set of instances serving as training dataException - if the classifier has not been generated successfullypublic void updateClassifier(Instance instance) throws Exception
updateClassifier in interface UpdateableClassifierinstance - the instance to addException - if instance could not be incorporated
successfullypublic double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinstance - the instance to be classifiedException - if distribution can't be computed successfullypublic String toString()
public String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(String[] argv)
argv - the optionsCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.