All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.classifiers.AdaBoostM1
java.lang.Object
|
+----weka.classifiers.Classifier
|
+----weka.classifiers.DistributionClassifier
|
+----weka.classifiers.AdaBoostM1
- public class AdaBoostM1
- extends DistributionClassifier
- implements OptionHandler, WeightedInstancesHandler, Sourcable
Class for boosting a classifier using Freund & Schapire's Adaboost
M1 method. For more information, see
Yoav Freund and Robert E. Schapire
(1996). Experiments with a new boosting algorithm. Proc
International Conference on Machine Learning, pages 148-156, Morgan
Kaufmann, San Francisco.
Valid options are:
-D
Turn on debugging output.
-W classname
Specify the full class name of a classifier as the basis for
boosting (required).
-I num
Set the number of boost iterations (default 10).
-P num
Set the percentage of weight mass used to build classifiers
(default 100).
-Q
Use resampling instead of reweighting.
-S seed
Random number seed for resampling (default 1).
Options after -- are passed to the designated classifier.
- Version:
- $Revision: 1.10 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)
-
AdaBoostM1()
-
-
buildClassifier(Instances)
- Boosting method.
-
distributionForInstance(Instance)
- Calculates the class membership probabilities for the given test instance.
-
getClassifier()
- Get the classifier used as the classifier
-
getDebug()
- Get whether debugging is turned on
-
getMaxIterations()
- Get the maximum number of boost iterations
-
getOptions()
- Gets the current settings of the Classifier.
-
getSeed()
- Get seed for resampling.
-
getUseResampling()
- Get whether resampling is turned on
-
getWeightThreshold()
- Get the degree of weight thresholding
-
listOptions()
- Returns an enumeration describing the available options
-
main(String[])
- Main method for testing this class.
-
setClassifier(Classifier)
- Set the classifier for boosting.
-
setDebug(boolean)
- Set debugging mode
-
setMaxIterations(int)
- Set the maximum number of boost iterations
-
setOptions(String[])
- Parses a given list of options.
-
setSeed(int)
- Set seed for resampling.
-
setUseResampling(boolean)
- Set resampling mode
-
setWeightThreshold(int)
- Set weight threshold
-
toSource(String)
- Returns the boosted model as Java source code.
-
toString()
- Returns description of the boosted classifier.
AdaBoostM1
public AdaBoostM1()
listOptions
public Enumeration listOptions()
- Returns an enumeration describing the available options
- 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:
-D
Turn on debugging output.
-W classname
Specify the full class name of a classifier as the basis for
boosting (required).
-I num
Set the number of boost iterations (default 10).
-P num
Set the percentage of weight mass used to build classifiers
(default 100).
-Q
Use resampling instead of reweighting.
-S seed
Random number seed for resampling (default 1).
Options after -- are passed to the designated classifier.
- 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.
- Returns:
- an array of strings suitable for passing to setOptions
setClassifier
public void setClassifier(Classifier newClassifier)
- Set the classifier for boosting.
- Parameters:
- newClassifier - the Classifier to use.
getClassifier
public Classifier getClassifier()
- Get the classifier used as the classifier
- Returns:
- the classifier used as the classifier
setMaxIterations
public void setMaxIterations(int maxIterations)
- Set the maximum number of boost iterations
getMaxIterations
public int getMaxIterations()
- Get the maximum number of boost iterations
- Returns:
- the maximum number of boost iterations
setWeightThreshold
public void setWeightThreshold(int threshold)
- Set weight threshold
- Parameters:
- thresholding - the percentage of weight mass used for training
getWeightThreshold
public int getWeightThreshold()
- Get the degree of weight thresholding
- Returns:
- the percentage of weight mass used for training
setSeed
public void setSeed(int seed)
- Set seed for resampling.
- Parameters:
- seed - the seed for resampling
getSeed
public int getSeed()
- Get seed for resampling.
- Returns:
- the seed for resampling
setDebug
public void setDebug(boolean debug)
- Set debugging mode
- Parameters:
- debug - true if debug output should be printed
getDebug
public boolean getDebug()
- Get whether debugging is turned on
- Returns:
- true if debugging output is on
setUseResampling
public void setUseResampling(boolean r)
- Set resampling mode
- Parameters:
- resampling - true if resampling should be done
getUseResampling
public boolean getUseResampling()
- Get whether resampling is turned on
- Returns:
- true if resampling output is on
buildClassifier
public void buildClassifier(Instances data) throws Exception
- Boosting method.
- Parameters:
- data - the training data to be used for generating the
boosted classifier.
- Throws: Exception
- if the classifier could not be built successfully
- Overrides:
- buildClassifier in class Classifier
distributionForInstance
public double[] distributionForInstance(Instance instance) throws Exception
- Calculates the class membership probabilities for the given test instance.
- Parameters:
- instance - the instance to be classified
- Returns:
- predicted class probability distribution
- Throws: Exception
- if instance could not be classified
successfully
- Overrides:
- distributionForInstance in class DistributionClassifier
toSource
public String toSource(String className) throws Exception
- Returns the boosted model as Java source code.
- Returns:
- the tree as Java source code
- Throws: Exception
- if something goes wrong
toString
public String toString()
- Returns description of the boosted classifier.
- Returns:
- description of the boosted classifier as a string
- Overrides:
- toString in class Object
main
public static void main(String argv[])
- Main method for testing this class.
- Parameters:
- argv - the options
All Packages Class Hierarchy This Package Previous Next Index WEKA's home