weka.classifiers.functions
Class VotedPerceptron

java.lang.Object
  |
  +--weka.classifiers.Classifier
        |
        +--weka.classifiers.functions.VotedPerceptron
All Implemented Interfaces:
java.lang.Cloneable, OptionHandler, java.io.Serializable

public class VotedPerceptron
extends Classifier
implements OptionHandler

Implements the voted perceptron algorithm by Freund and Schapire. Globally replaces all missing values, and transforms nominal attributes into binary ones. For more information, see

Y. Freund and R. E. Schapire (1998). Large margin classification using the perceptron algorithm. Proc. 11th Annu. Conf. on Comput. Learning Theory, pp. 209-217, ACM Press, New York, NY.

Valid options are:

-I num
The number of iterations to be performed. (default 1)

-E num
The exponent for the polynomial kernel. (default 1)

-S num
The seed for the random number generator. (default 1)

-M num
The maximum number of alterations allowed. (default 10000)

Version:
$Revision: 1.17 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
VotedPerceptron()
           
 
Method Summary
 void buildClassifier(Instances insts)
          Builds the ensemble of perceptrons.
 double[] distributionForInstance(Instance inst)
          Outputs the distribution for the given output.
 java.lang.String exponentTipText()
          Returns the tip text for this property
 double getExponent()
          Get the value of exponent.
 int getMaxK()
          Get the value of maxK.
 int getNumIterations()
          Get the value of NumIterations.
 java.lang.String[] getOptions()
          Gets the current settings of the classifier.
 int getSeed()
          Get the value of Seed.
 java.lang.String globalInfo()
          Returns a string describing this classifier
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method.
 java.lang.String maxKTipText()
          Returns the tip text for this property
 java.lang.String numIterationsTipText()
          Returns the tip text for this property
 java.lang.String seedTipText()
          Returns the tip text for this property
 void setExponent(double v)
          Set the value of exponent.
 void setMaxK(int v)
          Set the value of maxK.
 void setNumIterations(int v)
          Set the value of NumIterations.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setSeed(int v)
          Set the value of Seed.
 java.lang.String toString()
          Returns textual description of classifier.
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VotedPerceptron

public VotedPerceptron()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this classifier

Returns:
a description of the classifier suitable for displaying in the explorer/experimenter gui

listOptions

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

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class Classifier
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options. Valid options are:

-I num
The number of iterations to be performed. (default 1)

-E num
The exponent for the polynomial kernel. (default 1)

-S num
The seed for the random number generator. (default 1)

-M num
The maximum number of alterations allowed. (default 10000)

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
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:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions

buildClassifier

public void buildClassifier(Instances insts)
                     throws java.lang.Exception
Builds the ensemble of perceptrons.

Specified by:
buildClassifier in class Classifier
Parameters:
insts - set of instances serving as training data
Throws:
java.lang.Exception - if something goes wrong during building

distributionForInstance

public double[] distributionForInstance(Instance inst)
                                 throws java.lang.Exception
Outputs the distribution for the given output. Pipes output of SVM through sigmoid function.

Overrides:
distributionForInstance in class Classifier
Parameters:
inst - the instance for which distribution is to be computed
Returns:
the distribution
Throws:
java.lang.Exception - if something goes wrong

toString

public java.lang.String toString()
Returns textual description of classifier.

Overrides:
toString in class java.lang.Object

maxKTipText

public java.lang.String maxKTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getMaxK

public int getMaxK()
Get the value of maxK.

Returns:
Value of maxK.

setMaxK

public void setMaxK(int v)
Set the value of maxK.

Parameters:
v - Value to assign to maxK.

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.

exponentTipText

public java.lang.String exponentTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getExponent

public double getExponent()
Get the value of exponent.

Returns:
Value of exponent.

setExponent

public void setExponent(double v)
Set the value of exponent.

Parameters:
v - Value to assign to exponent.

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.

main

public static void main(java.lang.String[] argv)
Main method.



Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London