All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.Stacking

java.lang.Object
   |
   +----weka.classifiers.Classifier
           |
           +----weka.classifiers.Stacking

public class Stacking
extends Classifier
implements OptionHandler
Implements stacking. For more information, see

David H. Wolpert (1992). Stacked generalization. Neural Networks, 5:241-259, Pergamon Press.

Valid options are:

-X num_folds
The number of folds for the cross-validation (default 10).

-S seed
Random number seed (default 1).

-B classifierstring
Classifierstring should contain the full class name of a base scheme followed by options to the classifier. (required, option should be used once for each classifier).

-M classifierstring
Classifierstring for the meta classifier. Same format as for base classifiers. (required)

Version:
$Revision: 1.11 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)

Constructor Index

 o Stacking()

Method Index

 o buildClassifier(Instances)
Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.
 o classifyInstance(Instance)
Classifies a given instance using the stacked classifier.
 o getBaseClassifier(int)
Gets the specific classifier from the set of base classifiers.
 o getBaseClassifiers()
Gets the list of possible classifers to choose from.
 o getMetaClassifier()
Gets the meta classifier.
 o getNumFolds()
Gets the number of folds for the cross-validation.
 o getOptions()
Gets the current settings of the Classifier.
 o getSeed()
Gets the random number seed.
 o listOptions()
Returns an enumeration describing the available options
 o main(String[])
Main method for testing this class.
 o setBaseClassifiers(Classifier[])
Sets the list of possible classifers to choose from.
 o setMetaClassifier(Classifier)
Adds meta classifier
 o setNumFolds(int)
Sets the number of folds for the cross-validation.
 o setOptions(String[])
Parses a given list of options.
 o setSeed(int)
Sets the seed for random number generation.
 o toString()
Output a representation of this classifier

Constructors

 o Stacking
 public Stacking()

Methods

 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

Returns:
an enumeration of all the available options
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-X num_folds
The number of folds for the cross-validation (default 10).

-S seed
Random number seed (default 1).

-B classifierstring
Classifierstring should contain the full class name of a base scheme followed by options to the classifier. (required, option should be used once for each classifier).

-M classifierstring
Classifierstring for the meta classifier. Same format as for base classifiers. (required)

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o getOptions
 public String[] getOptions()
Gets the current settings of the Classifier.

Returns:
an array of strings suitable for passing to setOptions
 o setSeed
 public void setSeed(int seed)
Sets the seed for random number generation.

Parameters:
seed - the random number seed
 o getSeed
 public int getSeed()
Gets the random number seed.

Returns:
the random number seed
 o getNumFolds
 public int getNumFolds()
Gets the number of folds for the cross-validation.

Returns:
the number of folds for the cross-validation
 o setNumFolds
 public void setNumFolds(int numFolds) throws Exception
Sets the number of folds for the cross-validation.

Parameters:
numFolds - the number of folds for the cross-validation
Throws: Exception
if parameter illegal
 o setBaseClassifiers
 public void setBaseClassifiers(Classifier classifiers[])
Sets the list of possible classifers to choose from.

Parameters:
classifiers - an array of classifiers with all options set.
 o getBaseClassifiers
 public Classifier[] getBaseClassifiers()
Gets the list of possible classifers to choose from.

Returns:
the array of Classifiers
 o getBaseClassifier
 public Classifier getBaseClassifier(int index)
Gets the specific classifier from the set of base classifiers.

Parameters:
index - the index of the classifier to retrieve
Returns:
the classifier
 o setMetaClassifier
 public void setMetaClassifier(Classifier classifier)
Adds meta classifier

Parameters:
classifier - the classifier with all options set.
 o getMetaClassifier
 public Classifier getMetaClassifier()
Gets the meta classifier.

Returns:
the meta classifier
 o buildClassifier
 public void buildClassifier(Instances data) throws Exception
Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.

Parameters:
data - the training data to be used for generating the boosted classifier.
Throws: Exception
if the classifier could not be built successfully
Overrides:
buildClassifier in class Classifier
 o classifyInstance
 public double classifyInstance(Instance instance) throws Exception
Classifies a given instance using the stacked classifier.

Parameters:
instance - the instance to be classified
Throws: Exception
if instance could not be classified successfully
Overrides:
classifyInstance in class Classifier
 o toString
 public String toString()
Output a representation of this classifier

Overrides:
toString in class Object
 o main
 public static void main(String argv[])
Main method for testing this class.

Parameters:
argv - should contain the following arguments: -t training file [-T test file] [-c class index]

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home