weka.classifiers.lazy
Class LWLSynchro

java.lang.Object
  extended by weka.classifiers.AbstractClassifier
      extended by weka.classifiers.SingleClassifierEnhancer
          extended by weka.classifiers.lazy.LWL
              extended by weka.classifiers.lazy.LWLSynchro
All Implemented Interfaces:
Serializable, Cloneable, weka.classifiers.Classifier, weka.classifiers.UpdateableClassifier, weka.core.CapabilitiesHandler, weka.core.OptionHandler, weka.core.RevisionHandler, weka.core.TechnicalInformationHandler, weka.core.WeightedInstancesHandler
Direct Known Subclasses:
LWLIntervalEstimator

public class LWLSynchro
extends weka.classifiers.lazy.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..

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: the build(Instance) needs manual syncing with the original WEKA classifier (distributionForInstance(Instance) method).

Version:
$Revision: 5670 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz), Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
See Also:
LWL.distributionForInstance(Instance), Serialized Form

Field Summary
protected  boolean m_NoUpdate
          whether to suppress the update of the nearest-neighbor search algorithm when making predictions.
 
Fields inherited from class weka.classifiers.lazy.LWL
CONSTANT, EPANECHNIKOV, GAUSS, INVERSE, LINEAR, m_kNN, m_NNSearch, m_Train, m_UseAllK, m_WeightKernel, m_ZeroR, TRICUBE
 
Fields inherited from class weka.classifiers.SingleClassifierEnhancer
m_Classifier
 
Fields inherited from class weka.classifiers.AbstractClassifier
m_Debug
 
Constructor Summary
LWLSynchro()
          Initializes the classifier.
 
Method Summary
protected  void build(weka.core.Instance instance)
          Builds the classifier.
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.
 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.
 String toString()
          Returns a description of this classifier.
 
Methods inherited from class weka.classifiers.lazy.LWL
buildClassifier, enumerateMeasures, getCapabilities, getKNN, getMeasure, getNearestNeighbourSearchAlgorithm, getTechnicalInformation, getWeightingKernel, globalInfo, KNNTipText, nearestNeighbourSearchAlgorithmTipText, setKNN, setNearestNeighbourSearchAlgorithm, setWeightingKernel, updateClassifier, weightingKernelTipText
 
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getClassifier, getClassifierSpec, setClassifier
 
Methods inherited from class weka.classifiers.AbstractClassifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_NoUpdate

protected boolean m_NoUpdate
whether to suppress the update of the nearest-neighbor search algorithm when making predictions.

Constructor Detail

LWLSynchro

public LWLSynchro()
Initializes the classifier.

Method Detail

defaultClassifierString

protected String defaultClassifierString()
Default classifier classname.

Overrides:
defaultClassifierString in class weka.classifiers.lazy.LWL
Returns:
the classname

listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface weka.core.OptionHandler
Overrides:
listOptions in class weka.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 interface weka.core.OptionHandler
Overrides:
setOptions in class weka.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 interface weka.core.OptionHandler
Overrides:
getOptions in class weka.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

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 interface weka.classifiers.Classifier
Overrides:
distributionForInstance in class weka.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 class weka.classifiers.lazy.LWL
Returns:
a description of this classifier as a string.

getRevision

public String getRevision()
Returns the revision string.

Specified by:
getRevision in interface weka.core.RevisionHandler
Overrides:
getRevision in class weka.classifiers.lazy.LWL
Returns:
the revision

main

public static void main(String[] argv)
Main method for testing this class.

Parameters:
argv - the options


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.