类 Bagging
- 所有已实现的接口:
Serializable
,Cloneable
,AdditionalMeasureProducer
,CapabilitiesHandler
,OptionHandler
,Randomizable
,RevisionHandler
,TechnicalInformationHandler
,WeightedInstancesHandler
public class Bagging
extends RandomizableIteratedSingleClassifierEnhancer
implements WeightedInstancesHandler, AdditionalMeasureProducer, TechnicalInformationHandler
Class for bagging a classifier to reduce variance.
Can do classification and regression depending on the base learner.
For more information, see
Leo Breiman (1996). Bagging predictors. Machine Learning. 24(2):123-140. BibTeX:
For more information, see
Leo Breiman (1996). Bagging predictors. Machine Learning. 24(2):123-140. BibTeX:
@article{Breiman1996, author = {Leo Breiman}, journal = {Machine Learning}, number = {2}, pages = {123-140}, title = {Bagging predictors}, volume = {24}, year = {1996} }Valid options are:
-P Size of each bag, as a percentage of the training set size. (default 100)
-O Calculate the out of bag error.
-S <num> Random number seed. (default 1)
-I <num> Number of iterations. (default 10)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.REPTree)
Options specific to classifier weka.classifiers.trees.REPTree:
-M <minimum number of instances> Set minimum number of instances per leaf (default 2).
-V <minimum variance for split> Set minimum numeric class variance proportion of train variance for split (default 1e-3).
-N <number of folds> Number of folds for reduced error pruning (default 3).
-S <seed> Seed for random data shuffling (default 1).
-P No pruning.
-L Maximum tree depth (default -1, no maximum)Options after -- are passed to the designated classifier.
- 版本:
- $Revision: 11572 $
- 作者:
- Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (len@reeltwo.com), Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Returns the tip text for this propertyvoid
buildClassifier
(Instances data) Bagging method.Returns the tip text for this propertydouble[]
distributionForInstance
(Instance instance) Calculates the class membership probabilities for the given test instance.Returns an enumeration of the additional measure names.int
Gets the size of each bag, as a percentage of the training set size.boolean
Get whether the out of bag error is calculated.double
getMeasure
(String additionalMeasureName) Returns the value of the named measure.String[]
Gets the current settings of the Classifier.Returns the revision string.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.Returns a string describing classifierReturns an enumeration describing the available options.static void
Main method for testing this class.double
Gets the out of bag error that was calculated as the classifier was built.void
setBagSizePercent
(int newBagSizePercent) Sets the size of each bag, as a percentage of the training set size.void
setCalcOutOfBag
(boolean calcOutOfBag) Set whether the out of bag error is calculated.void
setOptions
(String[] options) Parses a given list of options.toString()
Returns description of the bagged classifier.从类继承的方法 weka.classifiers.RandomizableIteratedSingleClassifierEnhancer
getSeed, seedTipText, setSeed
从类继承的方法 weka.classifiers.IteratedSingleClassifierEnhancer
getNumIterations, numIterationsTipText, setNumIterations
从类继承的方法 weka.classifiers.SingleClassifierEnhancer
classifierTipText, getCapabilities, getClassifier, setClassifier
从类继承的方法 weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
Bagging
public Bagging()Constructor.
-
-
方法详细资料
-
globalInfo
Returns a string describing classifier- 返回:
- a description suitable for displaying in the explorer/experimenter gui
-
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.- 指定者:
getTechnicalInformation
在接口中TechnicalInformationHandler
- 返回:
- the technical information about this class
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 覆盖:
listOptions
在类中RandomizableIteratedSingleClassifierEnhancer
- 返回:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-P Size of each bag, as a percentage of the training set size. (default 100)
-O Calculate the out of bag error.
-S <num> Random number seed. (default 1)
-I <num> Number of iterations. (default 10)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.REPTree)
Options specific to classifier weka.classifiers.trees.REPTree:
-M <minimum number of instances> Set minimum number of instances per leaf (default 2).
-V <minimum variance for split> Set minimum numeric class variance proportion of train variance for split (default 1e-3).
-N <number of folds> Number of folds for reduced error pruning (default 3).
-S <seed> Seed for random data shuffling (default 1).
-P No pruning.
-L Maximum tree depth (default -1, no maximum)
Options after -- are passed to the designated classifier.- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中RandomizableIteratedSingleClassifierEnhancer
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中RandomizableIteratedSingleClassifierEnhancer
- 返回:
- an array of strings suitable for passing to setOptions
-
bagSizePercentTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getBagSizePercent
public int getBagSizePercent()Gets the size of each bag, as a percentage of the training set size.- 返回:
- the bag size, as a percentage.
-
setBagSizePercent
public void setBagSizePercent(int newBagSizePercent) Sets the size of each bag, as a percentage of the training set size.- 参数:
newBagSizePercent
- the bag size, as a percentage.
-
calcOutOfBagTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setCalcOutOfBag
public void setCalcOutOfBag(boolean calcOutOfBag) Set whether the out of bag error is calculated.- 参数:
calcOutOfBag
- whether to calculate the out of bag error
-
getCalcOutOfBag
public boolean getCalcOutOfBag()Get whether the out of bag error is calculated.- 返回:
- whether the out of bag error is calculated
-
measureOutOfBagError
public double measureOutOfBagError()Gets the out of bag error that was calculated as the classifier was built.- 返回:
- the out of bag error
-
enumerateMeasures
Returns an enumeration of the additional measure names.- 指定者:
enumerateMeasures
在接口中AdditionalMeasureProducer
- 返回:
- an enumeration of the measure names
-
getMeasure
Returns the value of the named measure.- 指定者:
getMeasure
在接口中AdditionalMeasureProducer
- 参数:
additionalMeasureName
- the name of the measure to query for its value- 返回:
- the value of the named measure
- 抛出:
IllegalArgumentException
- if the named measure is not supported
-
buildClassifier
Bagging method.- 覆盖:
buildClassifier
在类中IteratedSingleClassifierEnhancer
- 参数:
data
- the training data to be used for generating the bagged classifier.- 抛出:
Exception
- if the classifier could not be built successfully
-
distributionForInstance
Calculates the class membership probabilities for the given test instance.- 覆盖:
distributionForInstance
在类中Classifier
- 参数:
instance
- the instance to be classified- 返回:
- preedicted class probability distribution
- 抛出:
Exception
- if distribution can't be computed successfully
-
toString
Returns description of the bagged classifier. -
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Classifier
- 返回:
- the revision
-
main
Main method for testing this class.- 参数:
argv
- the options
-