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:
adams.core.Stoppable,adams.core.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, adams.core.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 booleanm_NoUpdatewhether to suppress the update of the nearest-neighbor search algorithm when making predictions.protected booleanm_Stoppedwhether 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 voidbuild(weka.core.Instance instance)Builds the classifier.voidbuildClassifier(weka.core.Instances instances)protected StringdefaultClassifierString()Default classifier classname.double[]distributionForInstance(weka.core.Instance instance)Calculates the class membership probabilities for the given test instance.booleangetNoUpdate()Returns whether to suppress the update of the nearest-neighbor search algorithm when making predictions.String[]getOptions()Gets the current settings of the classifier.StringgetRevision()Returns the revision string.booleanisStopped()Whether the execution has been stopped.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] argv)Main method for testing this class.StringnoUpdateTipText()Returns the tip text for this property.voidsetNoUpdate(boolean value)Sets whether to suppress updating the nearest-neighbor search algorithm when making predictions.voidsetOptions(String[] options)Parses a given list of options.voidstopExecution()Stops the execution.StringtoString()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:
defaultClassifierStringin classweka.classifiers.lazy.LWL- Returns:
- the classname
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin 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:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin 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:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin 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:
buildClassifierin interfaceweka.classifiers.Classifier- Overrides:
buildClassifierin classweka.classifiers.lazy.LWL- Throws:
Exception
-
build
protected void build(weka.core.Instance instance) throws ExceptionBuilds 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 ExceptionCalculates the class membership probabilities for the given test instance.- Specified by:
distributionForInstancein interfaceweka.classifiers.Classifier- Overrides:
distributionForInstancein 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:
toStringin classweka.classifiers.lazy.LWL- Returns:
- a description of this classifier as a string.
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceadams.core.Stoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStoppedin interfaceadams.core.StoppableWithFeedback- Returns:
- true if stopped
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.classifiers.lazy.LWL- Returns:
- the revision
-
main
public static void main(String[] argv)
Main method for testing this class.- Parameters:
argv- the options
-
-