All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.classifiers.Bagging
java.lang.Object
|
+----weka.classifiers.Classifier
|
+----weka.classifiers.DistributionClassifier
|
+----weka.classifiers.Bagging
- public class Bagging
- extends DistributionClassifier
- implements OptionHandler
Class for bagging a classifier. For more information, see
Leo Breiman (1996). Bagging predictors. Machine
Learning, 24(2):123-140.
Valid options are:
-W classname
Specify the full class name of a weak classifier as the basis for
boosting (required).
-I num
Set the number of bagging iterations (default 10).
-S seed
Random number seed for resampling (default 1).
Options after -- are passed to the designated classifier.
- Version:
- $Revision: 1.8 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
-
Bagging()
-
-
buildClassifier(Instances)
- Bagging method.
-
distributionForInstance(Instance)
- Calculates the class membership probabilities for the given test instance.
-
getClassifier()
- Get the classifier used as the classifier
-
getNumIterations()
- Gets the number of bagging iterations
-
getOptions()
- Gets the current settings of the Classifier.
-
getSeed()
- Gets the seed for the random number generations
-
listOptions()
- Returns an enumeration describing the available options
-
main(String[])
- Main method for testing this class.
-
setClassifier(Classifier)
- Set the classifier for boosting.
-
setNumIterations(int)
- Sets the number of bagging iterations
-
setOptions(String[])
- Parses a given list of options.
-
setSeed(int)
- Set the seed for random number generation.
-
toString()
- Returns description of the bagged classifier.
Bagging
public Bagging()
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:
-W classname
Specify the full class name of a weak classifier as the basis for
boosting (required).
-I num
Set the number of bagging iterations (default 10).
-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
setNumIterations
public void setNumIterations(int numIterations)
- Sets the number of bagging iterations
getNumIterations
public int getNumIterations()
- Gets the number of bagging iterations
- Returns:
- the maximum number of bagging iterations
setSeed
public void setSeed(int seed)
- Set the seed for random number generation.
- Parameters:
- seed - the seed
getSeed
public int getSeed()
- Gets the seed for the random number generations
- Returns:
- the seed for the random number generation
buildClassifier
public void buildClassifier(Instances data) throws Exception
- Bagging method.
- Parameters:
- data - the training data to be used for generating the
bagged 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:
- preedicted class probability distribution
- Throws: Exception
- if distribution can't be computed successfully
- Overrides:
- distributionForInstance in class DistributionClassifier
toString
public String toString()
- Returns description of the bagged classifier.
- Returns:
- description of the bagged 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