Package weka.classifiers.meta
Class PartitionedStacking
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.MultipleClassifiersCombiner
-
- weka.classifiers.ParallelMultipleClassifiersCombiner
-
- weka.classifiers.meta.PartitionedStacking
-
- 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
public class PartitionedStacking extends weka.classifiers.ParallelMultipleClassifiersCombinerBuilds the base-classifiers on subsets of the data defined by ranges that correspond to the base-classifiers. The base-classifiers expect the class attribute to be the last attribute in the range of attributes that is defined for them.
The predictions of the base-classifiers and the original class attribute are used to generated a new meta-dataset that is used as input for the meta-level classifier.
Valid options are:
-R <range> The attributes ranges to use for training the base-classifiers. Must be specified as often as there are base-classifiers. This is a comma separated list of attribute indices, with "first" and "last" valid values. Specify an inclusive range with "-". E.g: "first-3,5,6-10,last".
-M <classifier specification> Full class name of the classifier to use for the meta-level, followed by scheme options. (default: "weka.classifiers.trees.M5P")
-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")
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Classifierm_MetaLevelClassifierthe meta-level classifier.protected weka.core.Instancesm_MetaLevelDatathe header for the meta-level data.protected weka.core.Range[]m_Rangesthe attribute ranges for the base-classifiers.protected weka.filters.unsupervised.attribute.Remove[]m_Removethe filters for removing the unwanted attributes for the base classifiers.
-
Constructor Summary
Constructors Constructor Description PartitionedStacking()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(weka.core.Instances data)Builds the classifier.protected voidbuildClassifiers(weka.core.Instances data)Does the actual construction of the base-classifiers.doubleclassifyInstance(weka.core.Instance instance)Classifies the given test instance.weka.core.CapabilitiesgetCapabilities()Returns combined capabilities of the base classifiers, i.e., the capabilities all of them have in common.weka.classifiers.ClassifiergetMetaLevelClassifier()Returns the meta-level classifier.String[]getOptions()Gets the current settings of the Classifier.weka.core.Range[]getRanges()Returns the attribute ranges for the base-classifiers.StringgetRevision()Returns the revision string.StringglobalInfo()Returns a string describing this classifier.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for running this classifier.StringmetaLevelClassifierTipText()Returns the tip text for this property.StringrangesTipText()Returns the tip text for this property.voidsetMetaLevelClassifier(weka.classifiers.Classifier value)Sets the meta-level classifier.voidsetOptions(String[] options)Parses a given list of options.voidsetRanges(weka.core.Range[] value)Sets the attribute ranges for the base-classifiers.-
Methods inherited from class weka.classifiers.ParallelMultipleClassifiersCombiner
completedClassifier, getNumExecutionSlots, numExecutionSlotsTipText, setNumExecutionSlots, startExecutorPool
-
Methods inherited from class weka.classifiers.MultipleClassifiersCombiner
classifiersTipText, getClassifier, getClassifiers, getClassifierSpec, postExecution, preExecution, setClassifiers
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
m_MetaLevelClassifier
protected weka.classifiers.Classifier m_MetaLevelClassifier
the meta-level classifier.
-
m_Ranges
protected weka.core.Range[] m_Ranges
the attribute ranges for the base-classifiers.
-
m_Remove
protected weka.filters.unsupervised.attribute.Remove[] m_Remove
the filters for removing the unwanted attributes for the base classifiers.
-
m_MetaLevelData
protected weka.core.Instances m_MetaLevelData
the header for the meta-level data.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this classifier.- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration 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:
-R <range> The attributes ranges to use for training the base-classifiers. Must be specified as often as there are base-classifiers. This is a comma separated list of attribute indices, with "first" and "last" valid values. Specify an inclusive range with "-". E.g: "first-3,5,6-10,last".
-M <classifier specification> Full class name of the classifier to use for the meta-level, followed by scheme options. (default: "weka.classifiers.trees.M5P")
-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")
-D If set, classifier is run in debug mode and may output additional info to the console
- 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
-
setRanges
public void setRanges(weka.core.Range[] value)
Sets the attribute ranges for the base-classifiers.- Parameters:
value- the ranges
-
getRanges
public weka.core.Range[] getRanges()
Returns the attribute ranges for the base-classifiers.- Returns:
- the ranges
-
rangesTipText
public String rangesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMetaLevelClassifier
public void setMetaLevelClassifier(weka.classifiers.Classifier value)
Sets the meta-level classifier.- Parameters:
value- the meta-level classifier
-
getMetaLevelClassifier
public weka.classifiers.Classifier getMetaLevelClassifier()
Returns the meta-level classifier.- Returns:
- the meta-level classifier
-
metaLevelClassifierTipText
public String metaLevelClassifierTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
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
-
buildClassifiers
protected void buildClassifiers(weka.core.Instances data) throws ExceptionDoes the actual construction of the base-classifiers.- Overrides:
buildClassifiersin classweka.classifiers.ParallelMultipleClassifiersCombiner- Parameters:
data- the data to use as basis for base-classifiers- Throws:
Exception- if something goes wrong during the training process
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionBuilds the classifier.- Specified by:
buildClassifierin interfaceweka.classifiers.Classifier- Overrides:
buildClassifierin classweka.classifiers.ParallelMultipleClassifiersCombiner- Parameters:
data- the training data to be used for generating the classifier- Throws:
Exception- if the classifier could not be built successfully
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws ExceptionClassifies the given test instance. The instance has to belong to a dataset when it's being classified.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted most likely class for the instance or Utils.missingValue() if no prediction is made
- Throws:
Exception- if an error occurred during the prediction
-
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 running this classifier.- Parameters:
args- the parameters, use -h to display them
-
-