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)
-
Stacking()
-
-
buildClassifier(Instances)
- Buildclassifier selects a classifier from the set of classifiers
by minimising error on the training data.
-
classifyInstance(Instance)
- Classifies a given instance using the stacked classifier.
-
getBaseClassifier(int)
- Gets the specific classifier from the set of base classifiers.
-
getBaseClassifiers()
- Gets the list of possible classifers to choose from.
-
getMetaClassifier()
- Gets the meta classifier.
-
getNumFolds()
-
Gets the number of folds for the cross-validation.
-
getOptions()
- Gets the current settings of the Classifier.
-
getSeed()
- Gets the random number seed.
-
listOptions()
- Returns an enumeration describing the available options
-
main(String[])
- Main method for testing this class.
-
setBaseClassifiers(Classifier[])
- Sets the list of possible classifers to choose from.
-
setMetaClassifier(Classifier)
- Adds meta classifier
-
setNumFolds(int)
- Sets the number of folds for the cross-validation.
-
setOptions(String[])
- Parses a given list of options.
-
setSeed(int)
- Sets the seed for random number generation.
-
toString()
- Output a representation of this classifier
Stacking
public Stacking()
listOptions
public Enumeration listOptions()
- Returns an enumeration describing the available options
- 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:
-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
getOptions
public String[] getOptions()
- Gets the current settings of the Classifier.
- Returns:
- an array of strings suitable for passing to setOptions
setSeed
public void setSeed(int seed)
- Sets the seed for random number generation.
- Parameters:
- seed - the random number seed
getSeed
public int getSeed()
- Gets the random number seed.
- Returns:
- the random number seed
getNumFolds
public int getNumFolds()
- Gets the number of folds for the cross-validation.
- Returns:
- the number of folds for the cross-validation
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
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.
getBaseClassifiers
public Classifier[] getBaseClassifiers()
- Gets the list of possible classifers to choose from.
- Returns:
- the array of Classifiers
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
setMetaClassifier
public void setMetaClassifier(Classifier classifier)
- Adds meta classifier
- Parameters:
- classifier - the classifier with all options set.
getMetaClassifier
public Classifier getMetaClassifier()
- Gets the meta classifier.
- Returns:
- the meta classifier
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
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
toString
public String toString()
- Output a representation of this classifier
- Overrides:
- toString in class Object
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