Package weka.classifiers.meta
Class Stacking
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.MultipleClassifiersCombiner
weka.classifiers.RandomizableMultipleClassifiersCombiner
weka.classifiers.meta.Stacking
- All Implemented Interfaces:
Serializable,Cloneable,CapabilitiesHandler,OptionHandler,Randomizable,RevisionHandler,TechnicalInformationHandler
public class Stacking
extends RandomizableMultipleClassifiersCombiner
implements TechnicalInformationHandler
Combines several classifiers using the stacking method. Can do classification or regression.
For more information, see
David H. Wolpert (1992). Stacked generalization. Neural Networks. 5:241-259. BibTeX:
For more information, see
David H. Wolpert (1992). Stacked generalization. Neural Networks. 5:241-259. BibTeX:
@article{Wolpert1992,
author = {David H. Wolpert},
journal = {Neural Networks},
pages = {241-259},
publisher = {Pergamon Press},
title = {Stacked generalization},
volume = {5},
year = {1992}
}
Valid options are:
-M <scheme specification> Full name of meta classifier, followed by options. (default: "weka.classifiers.rules.Zero")
-X <number of folds> Sets the number of cross-validation folds.
-S <num> Random number seed. (default 1)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision: 6996 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildClassifier(Instances data) Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.double[]distributionForInstance(Instance instance) Returns class probabilities.Returns combined capabilities of the base classifiers, i.e., the capabilities all of them have in common.Gets the meta classifier.intGets the number of folds for the cross-validation.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 voidMain method for testing this class.Returns the tip text for this propertyReturns the tip text for this propertyvoidsetMetaClassifier(Classifier classifier) Adds meta classifiervoidsetNumFolds(int numFolds) Sets the number of folds for the cross-validation.voidsetOptions(String[] options) Parses a given list of options.toString()Output a representation of this classifierMethods inherited from class weka.classifiers.RandomizableMultipleClassifiersCombiner
getSeed, seedTipText, setSeedMethods inherited from class weka.classifiers.MultipleClassifiersCombiner
classifiersTipText, getClassifier, getClassifiers, setClassifiersMethods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
Constructor Details
-
Stacking
public Stacking()
-
-
Method Details
-
globalInfo
Returns a string describing classifier- Returns:
- 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.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classRandomizableMultipleClassifiersCombiner- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-M <scheme specification> Full name of meta classifier, followed by options. (default: "weka.classifiers.rules.Zero")
-X <number of folds> Sets the number of cross-validation folds.
-S <num> Random number seed. (default 1)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-D If set, classifier is run in debug mode and may output additional info to the console
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classRandomizableMultipleClassifiersCombiner- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classRandomizableMultipleClassifiersCombiner- Returns:
- an array of strings suitable for passing to setOptions
-
numFoldsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNumFolds
public int getNumFolds()Gets the number of folds for the cross-validation.- Returns:
- the number of folds for the cross-validation
-
setNumFolds
Sets the number of folds for the cross-validation.- Parameters:
numFolds- the number of folds for the cross-validation- Throws:
Exception- if parameter illegal
-
metaClassifierTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMetaClassifier
Adds meta classifier- Parameters:
classifier- the classifier with all options set.
-
getMetaClassifier
Gets the meta classifier.- Returns:
- the meta classifier
-
getCapabilities
Returns combined capabilities of the base classifiers, i.e., the capabilities all of them have in common.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classMultipleClassifiersCombiner- Returns:
- the capabilities of the base classifiers
- See Also:
-
buildClassifier
Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.- Specified by:
buildClassifierin classClassifier- Parameters:
data- the training data to be used for generating the boosted classifier.- Throws:
Exception- if the classifier could not be built successfully
-
distributionForInstance
Returns class probabilities.- Overrides:
distributionForInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- the distribution
- Throws:
Exception- if instance could not be classified successfully
-
toString
Output a representation of this classifier -
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv- should contain the following arguments: -t training file [-T test file] [-c class index]
-