Package weka.classifiers.meta
Class GroupedStacking
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.MultipleClassifiersCombiner
-
- weka.classifiers.ParallelMultipleClassifiersCombiner
-
- weka.classifiers.meta.GroupedStacking
-
- All Implemented Interfaces:
Serializable,Cloneable,weka.classifiers.Classifier,weka.core.BatchPredictor,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.RevisionHandler,weka.core.TechnicalInformationHandler
public class GroupedStacking extends weka.classifiers.ParallelMultipleClassifiersCombiner implements weka.core.TechnicalInformationHandlerCombines several classifiers using the stacking method. Can do classification or regression.
Uses the specified fold generator for generating the fold pairs for the meta-level.
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")
-generator <classname and options> Sets the cross-validation fold generator to use. (default: weka.classifiers.DefaultCrossValidationFoldGenerator)
-num-slots <num> Number of execution slots. (default 1 - i.e. no parallelism)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
Options specific to classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
Options specific to meta classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
- Author:
- Eibe Frank ([email protected])
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CrossValidationFoldGeneratorm_ActualGeneratorthe actual fold generator in use.protected weka.core.Instancesm_BaseFormatFormat for base dataprotected CrossValidationFoldGeneratorm_Generatorthe fold generator.protected weka.classifiers.Classifierm_MetaClassifierThe meta classifierprotected weka.core.Instancesm_MetaFormatFormat for meta data
-
Constructor Summary
Constructors Constructor Description GroupedStacking()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(weka.core.Instances data)Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.double[]distributionForInstance(weka.core.Instance instance)Returns class probabilities.protected voidgenerateMetaLevel(weka.core.Instances newData)Generates the meta dataStringgeneratorTipText()Returns the tip text for this propertyweka.core.CapabilitiesgetCapabilities()Returns combined capabilities of the base classifiers, i.e., the capabilities all of them have in common.CrossValidationFoldGeneratorgetGenerator()Gets the cross-validation fold generator to use.weka.classifiers.ClassifiergetMetaClassifier()Gets the meta classifier.String[]getOptions()Gets the current settings of the Classifier.StringgetRevision()Returns the revision string.weka.core.TechnicalInformationgetTechnicalInformation()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.StringglobalInfo()Returns a string describing classifierEnumeration<weka.core.Option>listOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for testing this class.StringmetaClassifierTipText()Returns the tip text for this propertyprotected weka.core.InstancesmetaFormat(weka.core.Instances instances)Makes the format for the level-1 data.protected weka.core.InstancemetaInstance(weka.core.Instance instance)Makes a level-1 instance from the given instance.voidpostExecution()voidpreExecution()voidsetGenerator(CrossValidationFoldGenerator value)Sets the cross-validation fold generator to use.voidsetMetaClassifier(weka.classifiers.Classifier classifier)Adds meta classifiervoidsetOptions(String[] options)Parses a given list of options.StringtoString()Output a representation of this classifier-
Methods inherited from class weka.classifiers.ParallelMultipleClassifiersCombiner
buildClassifiers, completedClassifier, getNumExecutionSlots, numExecutionSlotsTipText, setNumExecutionSlots, startExecutorPool
-
Methods inherited from class weka.classifiers.MultipleClassifiersCombiner
classifiersTipText, getClassifier, getClassifiers, getClassifierSpec, setClassifiers
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
m_MetaClassifier
protected weka.classifiers.Classifier m_MetaClassifier
The meta classifier
-
m_MetaFormat
protected weka.core.Instances m_MetaFormat
Format for meta data
-
m_BaseFormat
protected weka.core.Instances m_BaseFormat
Format for base data
-
m_Generator
protected CrossValidationFoldGenerator m_Generator
the fold generator.
-
m_ActualGenerator
protected CrossValidationFoldGenerator m_ActualGenerator
the actual fold generator in use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public weka.core.TechnicalInformation 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 interfaceweka.core.TechnicalInformationHandler- Returns:
- the technical information about this class
-
listOptions
public Enumeration<weka.core.Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.classifiers.ParallelMultipleClassifiersCombiner- 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:-M <scheme specification> Full name of meta classifier, followed by options. (default: "weka.classifiers.rules.Zero")
-generator <classname and options> Sets the cross-validation fold generator to use. (default: weka.classifiers.DefaultCrossValidationFoldGenerator)
-num-slots <num> Number of execution slots. (default 1 - i.e. no parallelism)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
Options specific to classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
Options specific to meta classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.classifiers.ParallelMultipleClassifiersCombiner- 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.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.classifiers.ParallelMultipleClassifiersCombiner- Returns:
- an array of strings suitable for passing to setOptions
-
generatorTipText
public String generatorTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getGenerator
public CrossValidationFoldGenerator getGenerator()
Gets the cross-validation fold generator to use.- Returns:
- the generator
-
setGenerator
public void setGenerator(CrossValidationFoldGenerator value)
Sets the cross-validation fold generator to use.- Parameters:
value- the generator
-
metaClassifierTipText
public String metaClassifierTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMetaClassifier
public void setMetaClassifier(weka.classifiers.Classifier classifier)
Adds meta classifier- Parameters:
classifier- the classifier with all options set.
-
getMetaClassifier
public weka.classifiers.Classifier getMetaClassifier()
Gets the meta classifier.- Returns:
- the meta classifier
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns combined capabilities of the base classifiers, i.e., the capabilities all of them have in common.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin classweka.classifiers.MultipleClassifiersCombiner- Returns:
- the capabilities of the base classifiers
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionBuildclassifier selects a classifier from the set of classifiers by minimising error on the training data.- Specified by:
buildClassifierin interfaceweka.classifiers.Classifier- Overrides:
buildClassifierin classweka.classifiers.ParallelMultipleClassifiersCombiner- Parameters:
data- the training data to be used for generating the boosted classifier.- Throws:
Exception- if the classifier could not be built successfully
-
generateMetaLevel
protected void generateMetaLevel(weka.core.Instances newData) throws ExceptionGenerates the meta data- Parameters:
newData- the data to work on- Throws:
Exception- if generation fails
-
distributionForInstance
public double[] distributionForInstance(weka.core.Instance instance) throws ExceptionReturns class probabilities.- Specified by:
distributionForInstancein interfaceweka.classifiers.Classifier- Overrides:
distributionForInstancein classweka.classifiers.AbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- the distribution
- Throws:
Exception- if instance could not be classified successfully
-
toString
public String toString()
Output a representation of this classifier
-
metaFormat
protected weka.core.Instances metaFormat(weka.core.Instances instances) throws ExceptionMakes the format for the level-1 data.- Parameters:
instances- the level-0 format- Returns:
- the format for the meta data
- Throws:
Exception- if the format generation fails
-
metaInstance
protected weka.core.Instance metaInstance(weka.core.Instance instance) throws ExceptionMakes a level-1 instance from the given instance.- Parameters:
instance- the instance to be transformed- Returns:
- the level-1 instance
- Throws:
Exception- if the instance generation fails
-
preExecution
public void preExecution() throws Exception- Specified by:
preExecutionin interfaceweka.core.CommandlineRunnable- Overrides:
preExecutionin classweka.classifiers.MultipleClassifiersCombiner- Throws:
Exception
-
postExecution
public void postExecution() throws Exception- Specified by:
postExecutionin interfaceweka.core.CommandlineRunnable- Overrides:
postExecutionin classweka.classifiers.MultipleClassifiersCombiner- Throws:
Exception
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.classifiers.AbstractClassifier- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args- should contain the following arguments: -t training file [-T test file] [-c class index]
-
-