Package weka.classifiers.functions
Class Winnow
- java.lang.Object
-
- weka.classifiers.Classifier
-
- weka.classifiers.functions.Winnow
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,UpdateableClassifier,CapabilitiesHandler,OptionHandler,RevisionHandler,TechnicalInformationHandler
public class Winnow extends Classifier implements UpdateableClassifier, TechnicalInformationHandler
Implements Winnow and Balanced Winnow algorithms by Littlestone.
For more information, see
N. Littlestone (1988). Learning quickly when irrelevant attributes are abound: A new linear threshold algorithm. Machine Learning. 2:285-318.
N. Littlestone (1989). Mistake bounds and logarithmic linear-threshold learning algorithms. University of California, Santa Cruz.
Does classification for problems with nominal attributes (which it converts into binary attributes). BibTeX:@article{Littlestone1988, author = {N. Littlestone}, journal = {Machine Learning}, pages = {285-318}, title = {Learning quickly when irrelevant attributes are abound: A new linear threshold algorithm}, volume = {2}, year = {1988} } @techreport{Littlestone1989, address = {University of California, Santa Cruz}, author = {N. Littlestone}, institution = {University of California}, note = {Technical Report UCSC-CRL-89-11}, title = {Mistake bounds and logarithmic linear-threshold learning algorithms}, year = {1989} }Valid options are:-L Use the baLanced version (default false)
-I <int> The number of iterations to be performed. (default 1)
-A <double> Promotion coefficient alpha. (default 2.0)
-B <double> Demotion coefficient beta. (default 0.5)
-H <double> Prediction threshold. (default -1.0 == number of attributes)
-W <double> Starting weights. (default 2.0)
-S <int> Default random seed. (default 1)
- Version:
- $Revision: 5523 $
- Author:
- J. Lindgren (jtlindgr at cs.helsinki.fi)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Winnow()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringalphaTipText()Returns the tip text for this propertyjava.lang.StringbalancedTipText()Returns the tip text for this propertyjava.lang.StringbetaTipText()Returns the tip text for this propertyvoidbuildClassifier(Instances insts)Builds the classifierdoubleclassifyInstance(Instance inst)Outputs the prediction for the given instance.java.lang.StringdefaultWeightTipText()Returns the tip text for this propertydoublegetAlpha()Get the value of Alpha.booleangetBalanced()Get the value of Balanced.doublegetBeta()Get the value of Beta.CapabilitiesgetCapabilities()Returns default capabilities of the classifier.doublegetDefaultWeight()Get the value of defaultWeight.intgetNumIterations()Get the value of numIterations.java.lang.String[]getOptions()Gets the current settings of the classifier.java.lang.StringgetRevision()Returns the revision string.intgetSeed()Get the value of Seed.TechnicalInformationgetTechnicalInformation()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.doublegetThreshold()Get the value of Threshold.java.lang.StringglobalInfo()Returns a string describing classifierjava.util.EnumerationlistOptions()Returns an enumeration describing the available optionsstatic voidmain(java.lang.String[] argv)Main method.java.lang.StringnumIterationsTipText()Returns the tip text for this propertyjava.lang.StringseedTipText()Returns the tip text for this propertyvoidsetAlpha(double a)Set the value of Alpha.voidsetBalanced(boolean b)Set the value of Balanced.voidsetBeta(double b)Set the value of Beta.voidsetDefaultWeight(double w)Set the value of defaultWeight.voidsetNumIterations(int v)Set the value of numIterations.voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetSeed(int v)Set the value of Seed.voidsetThreshold(double t)Set the value of Threshold.java.lang.StringthresholdTipText()Returns the tip text for this propertyjava.lang.StringtoString()Returns textual description of the classifier.voidupdateClassifier(Instance instance)Updates the classifier with a new learning example-
Methods inherited from class weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public 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.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassifier- Returns:
- an enumeration of all the available options
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-L Use the baLanced version (default false)
-I <int> The number of iterations to be performed. (default 1)
-A <double> Promotion coefficient alpha. (default 2.0)
-B <double> Demotion coefficient beta. (default 0.5)
-H <double> Prediction threshold. (default -1.0 == number of attributes)
-W <double> Starting weights. (default 2.0)
-S <int> Default random seed. (default 1)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassifier- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classClassifier- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances insts) throws java.lang.Exception
Builds the classifier- Specified by:
buildClassifierin classClassifier- Parameters:
insts- the data to train the classifier with- Throws:
java.lang.Exception- if something goes wrong during building
-
updateClassifier
public void updateClassifier(Instance instance) throws java.lang.Exception
Updates the classifier with a new learning example- Specified by:
updateClassifierin interfaceUpdateableClassifier- Parameters:
instance- the instance to update the classifier with- Throws:
java.lang.Exception- if something goes wrong
-
classifyInstance
public double classifyInstance(Instance inst) throws java.lang.Exception
Outputs the prediction for the given instance.- Overrides:
classifyInstancein classClassifier- Parameters:
inst- the instance for which prediction is to be computed- Returns:
- the prediction
- Throws:
java.lang.Exception- if something goes wrong
-
toString
public java.lang.String toString()
Returns textual description of the classifier.- Overrides:
toStringin classjava.lang.Object- Returns:
- textual description of the classifier
-
balancedTipText
public java.lang.String balancedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getBalanced
public boolean getBalanced()
Get the value of Balanced.- Returns:
- Value of Balanced.
-
setBalanced
public void setBalanced(boolean b)
Set the value of Balanced.- Parameters:
b- Value to assign to Balanced.
-
alphaTipText
public java.lang.String alphaTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getAlpha
public double getAlpha()
Get the value of Alpha.- Returns:
- Value of Alpha.
-
setAlpha
public void setAlpha(double a)
Set the value of Alpha.- Parameters:
a- Value to assign to Alpha.
-
betaTipText
public java.lang.String betaTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getBeta
public double getBeta()
Get the value of Beta.- Returns:
- Value of Beta.
-
setBeta
public void setBeta(double b)
Set the value of Beta.- Parameters:
b- Value to assign to Beta.
-
thresholdTipText
public java.lang.String thresholdTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getThreshold
public double getThreshold()
Get the value of Threshold.- Returns:
- Value of Threshold.
-
setThreshold
public void setThreshold(double t)
Set the value of Threshold.- Parameters:
t- Value to assign to Threshold.
-
defaultWeightTipText
public java.lang.String defaultWeightTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDefaultWeight
public double getDefaultWeight()
Get the value of defaultWeight.- Returns:
- Value of defaultWeight.
-
setDefaultWeight
public void setDefaultWeight(double w)
Set the value of defaultWeight.- Parameters:
w- Value to assign to defaultWeight.
-
numIterationsTipText
public java.lang.String numIterationsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumIterations
public int getNumIterations()
Get the value of numIterations.- Returns:
- Value of numIterations.
-
setNumIterations
public void setNumIterations(int v)
Set the value of numIterations.- Parameters:
v- Value to assign to numIterations.
-
seedTipText
public java.lang.String seedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSeed
public int getSeed()
Get the value of Seed.- Returns:
- Value of Seed.
-
setSeed
public void setSeed(int v)
Set the value of Seed.- Parameters:
v- Value to assign to Seed.
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
public static void main(java.lang.String[] argv)
Main method.- Parameters:
argv- the commandline options
-
-