|
||||||||||
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
public class LWL
Locally weighted learning. Uses an instance-based algorithm to assign instance weights which are then used by a specified WeightedInstancesHandler.
Can do classification (e.g. using naive Bayes) or regression (e.g. using linear regression).
For more info, see
Eibe Frank, Mark Hall, Bernhard Pfahringer: Locally Weighted Naive Bayes. In: 19th Conference in Uncertainty in Artificial Intelligence, 249-256, 2003.
C. Atkeson, A. Moore, S. Schaal (1996). Locally weighted learning. AI Review..
@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 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.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. |
Methods inherited from class weka.classifiers.SingleClassifierEnhancer |
---|
classifierTipText, getClassifier, setClassifier |
Methods inherited from class weka.classifiers.Classifier |
---|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, 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 TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.util.Enumeration enumerateMeasures()
public double getMeasure(java.lang.String additionalMeasureName)
additionalMeasureName
- the name of the measure to query for its value
java.lang.IllegalArgumentException
- if the named measure is not supportedpublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class SingleClassifierEnhancer
public 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 OptionHandler
setOptions
in class SingleClassifierEnhancer
options
- 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 OptionHandler
getOptions
in class SingleClassifierEnhancer
public 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 CapabilitiesHandler
getCapabilities
in class SingleClassifierEnhancer
Capabilities
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training data
java.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 add
java.lang.Exception
- if instance could not be incorporated
successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if distribution can't be computed successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
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 |