|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.functions.VotedPerceptron
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)
Field Summary | |
private int[] |
m_Additions
The training instances added to the perceptron |
private double |
m_Exponent
The exponent |
private boolean[] |
m_IsAddition
Addition or subtraction? |
private int |
m_K
The actual number of alterations |
private int |
m_MaxK
The maximum number of alterations to the perceptron |
private NominalToBinary |
m_NominalToBinary
The filter used to make attributes numeric. |
private int |
m_NumIterations
The number of iterations |
private ReplaceMissingValues |
m_ReplaceMissingValues
The filter used to get rid of missing values. |
private int |
m_Seed
Seed used for shuffling the dataset |
private Instances |
m_Train
The training instances |
private int[] |
m_Weights
The weights for each perceptron |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
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 |
private double |
innerProduct(Instance i1,
Instance i2)
Computes the inner product of two instances |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] argv)
Main method. |
private int |
makePrediction(int k,
Instance inst)
Compute a prediction from a perceptron |
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private int m_MaxK
private int m_NumIterations
private double m_Exponent
private int m_K
private int[] m_Additions
private boolean[] m_IsAddition
private int[] m_Weights
private Instances m_Train
private int m_Seed
private NominalToBinary m_NominalToBinary
private ReplaceMissingValues m_ReplaceMissingValues
Constructor Detail |
public VotedPerceptron()
Method Detail |
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-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)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public void buildClassifier(Instances insts) throws java.lang.Exception
buildClassifier
in class Classifier
insts
- set of instances serving as training data
java.lang.Exception
- if something goes wrong during buildingpublic double[] distributionForInstance(Instance inst) throws java.lang.Exception
distributionForInstance
in class Classifier
inst
- the instance for which distribution is to be computed
java.lang.Exception
- if something goes wrongpublic java.lang.String toString()
public java.lang.String maxKTipText()
public int getMaxK()
public void setMaxK(int v)
v
- Value to assign to maxK.public java.lang.String numIterationsTipText()
public int getNumIterations()
public void setNumIterations(int v)
v
- Value to assign to NumIterations.public java.lang.String exponentTipText()
public double getExponent()
public void setExponent(double v)
v
- Value to assign to exponent.public java.lang.String seedTipText()
public int getSeed()
public void setSeed(int v)
v
- Value to assign to Seed.private double innerProduct(Instance i1, Instance i2) throws java.lang.Exception
java.lang.Exception
private int makePrediction(int k, Instance inst) throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |