Package weka.classifiers.lazy
Class LWLSynchro
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.lazy.LWL
-
- weka.classifiers.lazy.LWLSynchro
-
- All Implemented Interfaces:
Stoppable
,StoppableWithFeedback
,Serializable
,Cloneable
,weka.classifiers.Classifier
,ThreadSafeClassifier
,weka.classifiers.UpdateableClassifier
,weka.core.BatchPredictor
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,weka.core.OptionHandler
,weka.core.RevisionHandler
,weka.core.TechnicalInformationHandler
,weka.core.WeightedInstancesHandler
- Direct Known Subclasses:
AbstainingLWL
,LWLIntervalEstimator
public class LWLSynchro extends weka.classifiers.lazy.LWL implements ThreadSafeClassifier, StoppableWithFeedback
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..
BibTeX:@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:
-no-update Suppresses the update of the nearest neighbor search (nns) algorithm with the data that is to be classified. (default: nns gets updated).
-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.functions.GaussianProcesses)
Options specific to classifier weka.classifiers.functions.GaussianProcesses:
-D If set, classifier is run in debug mode and may output additional info to the console
-L <double> Level of Gaussian Noise wrt transformed target. (default 1)
-N Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-C <num> The size of the cache (a prime number), 0 for full cache and -1 to turn it off. (default: 250007)
-E <num> The Exponent to use. (default: 1.0)
-L Use lower-order terms. (default: no)
Note: thebuild(Instance)
needs manual syncing with the original WEKA classifier (distributionForInstance(Instance)
method).- Version:
- $Revision$
- Author:
- Len Trigg ([email protected]), Eibe Frank ([email protected]), Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
- See Also:
LWL.distributionForInstance(Instance)
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_NoUpdate
whether to suppress the update of the nearest-neighbor search algorithm when making predictions.protected boolean
m_Stopped
whether the classifier was stopped.
-
Constructor Summary
Constructors Constructor Description LWLSynchro()
Initializes the classifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
build(weka.core.Instance instance)
Builds the classifier.void
buildClassifier(weka.core.Instances instances)
protected String
defaultClassifierString()
Default classifier classname.double[]
distributionForInstance(weka.core.Instance instance)
Calculates the class membership probabilities for the given test instance.boolean
getNoUpdate()
Returns whether to suppress the update of the nearest-neighbor search algorithm when making predictions.String[]
getOptions()
Gets the current settings of the classifier.String
getRevision()
Returns the revision string.boolean
isStopped()
Whether the execution has been stopped.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] argv)
Main method for testing this class.String
noUpdateTipText()
Returns the tip text for this property.void
setNoUpdate(boolean value)
Sets whether to suppress updating the nearest-neighbor search algorithm when making predictions.void
setOptions(String[] options)
Parses a given list of options.void
stopExecution()
Stops the execution.String
toString()
Returns a description of this classifier.-
Methods inherited from class weka.classifiers.lazy.LWL
enumerateMeasures, getCapabilities, getKNN, getMeasure, getNearestNeighbourSearchAlgorithm, getTechnicalInformation, getWeightingKernel, globalInfo, KNNTipText, nearestNeighbourSearchAlgorithmTipText, setKNN, setNearestNeighbourSearchAlgorithm, setWeightingKernel, updateClassifier, weightingKernelTipText
-
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, defaultClassifierOptions, getClassifier, getClassifierSpec, postExecution, preExecution, setClassifier
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Method Detail
-
defaultClassifierString
protected String defaultClassifierString()
Default classifier classname.- Overrides:
defaultClassifierString
in classweka.classifiers.lazy.LWL
- Returns:
- the classname
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classweka.classifiers.lazy.LWL
- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.
Valid options are:
-no-update Suppresses the update of the nearest neighbor search (nns) algorithm with the data that is to be classified. (default: nns gets updated).
-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.functions.GaussianProcesses)
Options specific to classifier weka.classifiers.functions.GaussianProcesses:
-D If set, classifier is run in debug mode and may output additional info to the console
-L <double> Level of Gaussian Noise wrt transformed target. (default 1)
-N Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-C <num> The size of the cache (a prime number), 0 for full cache and -1 to turn it off. (default: 250007)
-E <num> The Exponent to use. (default: 1.0)
-L Use lower-order terms. (default: no)
- Specified by:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in classweka.classifiers.lazy.LWL
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classweka.classifiers.lazy.LWL
- Returns:
- an array of strings suitable for passing to setOptions
-
noUpdateTipText
public String noUpdateTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNoUpdate
public void setNoUpdate(boolean value)
Sets whether to suppress updating the nearest-neighbor search algorithm when making predictions.- Parameters:
value
- if true then no update happens.
-
getNoUpdate
public boolean getNoUpdate()
Returns whether to suppress the update of the nearest-neighbor search algorithm when making predictions.- Returns:
- true if the update is suppressed
-
buildClassifier
public void buildClassifier(weka.core.Instances instances) throws Exception
- Specified by:
buildClassifier
in interfaceweka.classifiers.Classifier
- Overrides:
buildClassifier
in classweka.classifiers.lazy.LWL
- Throws:
Exception
-
build
protected void build(weka.core.Instance instance) throws Exception
Builds the classifier.
Note: needs manual syncing with the distributionForInstance method of the original WEKA classifier.- Parameters:
instance
- the instance to make prediction for- Throws:
Exception
- if build fails- See Also:
LWL.distributionForInstance(Instance)
-
distributionForInstance
public double[] distributionForInstance(weka.core.Instance instance) throws Exception
Calculates the class membership probabilities for the given test instance.- Specified by:
distributionForInstance
in interfaceweka.classifiers.Classifier
- Overrides:
distributionForInstance
in classweka.classifiers.lazy.LWL
- Parameters:
instance
- the instance to be classified- Returns:
- predicted class probability distribution
- Throws:
Exception
- if distribution can't be computed successfully
-
toString
public String toString()
Returns a description of this classifier.- Overrides:
toString
in classweka.classifiers.lazy.LWL
- Returns:
- a description of this classifier as a string.
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceStoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStopped
in interfaceStoppableWithFeedback
- Returns:
- true if stopped
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.classifiers.lazy.LWL
- Returns:
- the revision
-
main
public static void main(String[] argv)
Main method for testing this class.- Parameters:
argv
- the options
-
-