Package weka.classifiers.meta
Class RotationForest
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,CapabilitiesHandler,OptionHandler,Randomizable,RevisionHandler,TechnicalInformationHandler,WeightedInstancesHandler
public class RotationForest extends RandomizableIteratedSingleClassifierEnhancer implements WeightedInstancesHandler, TechnicalInformationHandler
Class for construction a Rotation Forest. Can do classification and regression depending on the base learner.
For more information, see
Juan J. Rodriguez, Ludmila I. Kuncheva, Carlos J. Alonso (2006). Rotation Forest: A new classifier ensemble method. IEEE Transactions on Pattern Analysis and Machine Intelligence. 28(10):1619-1630. URL http://doi.ieeecomputersociety.org/10.1109/TPAMI.2006.211. BibTeX:@article{Rodriguez2006, author = {Juan J. Rodriguez and Ludmila I. Kuncheva and Carlos J. Alonso}, journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence}, number = {10}, pages = {1619-1630}, title = {Rotation Forest: A new classifier ensemble method}, volume = {28}, year = {2006}, ISSN = {0162-8828}, URL = {http://doi.ieeecomputersociety.org/10.1109/TPAMI.2006.211} }Valid options are:-N Whether minGroup (-G) and maxGroup (-H) refer to the number of groups or their size. (default: false)
-G <num> Minimum size of a group of attributes: if numberOfGroups is true, the minimum number of groups. (default: 3)
-H <num> Maximum size of a group of attributes: if numberOfGroups is true, the maximum number of groups. (default: 3)
-P <num> Percentage of instances to be removed. (default: 50)
-F <filter specification> Full class name of filter to use, followed by filter options. eg: "weka.filters.unsupervised.attribute.PrincipalComponents-R 1.0"
-S <num> Random number seed. (default 1)
-I <num> Number of iterations. (default 10)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.J48)
Options specific to classifier weka.classifiers.trees.J48:
-U Use unpruned tree.
-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of instances> Set minimum number of instances per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-S Don't perform subtree raising.
-L Do not clean up after the tree has been built.
-A Laplace smoothing for predicted probabilities.
-Q <seed> Seed for random data shuffling (default 1).
- Version:
- $Revision: 7012 $
- Author:
- Juan Jose Rodriguez (jjrodriguez@ubu.es)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RotationForest()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(Instances data)builds the classifier.double[]distributionForInstance(Instance instance)Calculates the class membership probabilities for the given test instance.intgetMaxGroup()Gets the maximum size of a group.intgetMinGroup()Gets the minimum size of a group.booleangetNumberOfGroups()Get whether minGroup and maxGroup refer to the number of groups or their sizejava.lang.String[]getOptions()Gets the current settings of the Classifier.FiltergetProjectionFilter()Gets the filter used to project the data.intgetRemovedPercentage()Gets the percentage of instances to be removedjava.lang.StringgetRevision()Returns the revision string.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.java.lang.StringglobalInfo()Returns a string describing classifierjava.util.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] argv)Main method for testing this class.java.lang.StringmaxGroupTipText()Returns the tip text for this propertyjava.lang.StringminGroupTipText()Returns the tip text for this propertyjava.lang.StringnumberOfGroupsTipText()Returns the tip text for this propertyjava.lang.StringprojectionFilterTipText()Returns the tip text for this propertyjava.lang.StringremovedPercentageTipText()Returns the tip text for this propertyvoidsetMaxGroup(int maxGroup)Sets the maximum size of a group.voidsetMinGroup(int minGroup)Sets the minimum size of a group.voidsetNumberOfGroups(boolean numberOfGroups)Set whether minGroup and maxGroup refer to the number of groups or their sizevoidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetProjectionFilter(Filter projectionFilter)Sets the filter used to project the data.voidsetRemovedPercentage(int removedPercentage)Sets the percentage of instance to be removedjava.lang.StringtoString()Returns description of the Rotation Forest classifier.-
Methods inherited from class weka.classifiers.RandomizableIteratedSingleClassifierEnhancer
getSeed, seedTipText, setSeed
-
Methods inherited from class weka.classifiers.IteratedSingleClassifierEnhancer
getNumIterations, numIterationsTipText, setNumIterations
-
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getCapabilities, getClassifier, setClassifier
-
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public 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 interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classRandomizableIteratedSingleClassifierEnhancer- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-N Whether minGroup (-G) and maxGroup (-H) refer to the number of groups or their size. (default: false)
-G <num> Minimum size of a group of attributes: if numberOfGroups is true, the minimum number of groups. (default: 3)
-H <num> Maximum size of a group of attributes: if numberOfGroups is true, the maximum number of groups. (default: 3)
-P <num> Percentage of instances to be removed. (default: 50)
-F <filter specification> Full class name of filter to use, followed by filter options. eg: "weka.filters.unsupervised.attribute.PrincipalComponents-R 1.0"
-S <num> Random number seed. (default 1)
-I <num> Number of iterations. (default 10)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.J48)
Options specific to classifier weka.classifiers.trees.J48:
-U Use unpruned tree.
-C <pruning confidence> Set confidence threshold for pruning. (default 0.25)
-M <minimum number of instances> Set minimum number of instances per leaf. (default 2)
-R Use reduced error pruning.
-N <number of folds> Set number of folds for reduced error pruning. One fold is used as pruning set. (default 3)
-B Use binary splits only.
-S Don't perform subtree raising.
-L Do not clean up after the tree has been built.
-A Laplace smoothing for predicted probabilities.
-Q <seed> Seed for random data shuffling (default 1).
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classRandomizableIteratedSingleClassifierEnhancer- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classRandomizableIteratedSingleClassifierEnhancer- Returns:
- an array of strings suitable for passing to setOptions
-
numberOfGroupsTipText
public java.lang.String numberOfGroupsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumberOfGroups
public void setNumberOfGroups(boolean numberOfGroups)
Set whether minGroup and maxGroup refer to the number of groups or their size- Parameters:
numberOfGroups- whether minGroup and maxGroup refer to the number of groups or their size
-
getNumberOfGroups
public boolean getNumberOfGroups()
Get whether minGroup and maxGroup refer to the number of groups or their size- Returns:
- whether minGroup and maxGroup refer to the number of groups or their size
-
minGroupTipText
public java.lang.String minGroupTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMinGroup
public void setMinGroup(int minGroup) throws java.lang.IllegalArgumentExceptionSets the minimum size of a group.- Parameters:
minGroup- the minimum value. of attributes.- Throws:
java.lang.IllegalArgumentException
-
getMinGroup
public int getMinGroup()
Gets the minimum size of a group.- Returns:
- the minimum value.
-
maxGroupTipText
public java.lang.String maxGroupTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMaxGroup
public void setMaxGroup(int maxGroup) throws java.lang.IllegalArgumentExceptionSets the maximum size of a group.- Parameters:
maxGroup- the maximum value. of attributes.- Throws:
java.lang.IllegalArgumentException
-
getMaxGroup
public int getMaxGroup()
Gets the maximum size of a group.- Returns:
- the maximum value.
-
removedPercentageTipText
public java.lang.String removedPercentageTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setRemovedPercentage
public void setRemovedPercentage(int removedPercentage) throws java.lang.IllegalArgumentExceptionSets the percentage of instance to be removed- Parameters:
removedPercentage- the percentage.- Throws:
java.lang.IllegalArgumentException
-
getRemovedPercentage
public int getRemovedPercentage()
Gets the percentage of instances to be removed- Returns:
- the percentage.
-
projectionFilterTipText
public java.lang.String projectionFilterTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setProjectionFilter
public void setProjectionFilter(Filter projectionFilter)
Sets the filter used to project the data.- Parameters:
projectionFilter- the filter.
-
getProjectionFilter
public Filter getProjectionFilter()
Gets the filter used to project the data.- Returns:
- the filter.
-
toString
public java.lang.String toString()
Returns description of the Rotation Forest classifier.- Overrides:
toStringin classjava.lang.Object- Returns:
- description of the Rotation Forest classifier as a string
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
builds the classifier.- Overrides:
buildClassifierin classIteratedSingleClassifierEnhancer- Parameters:
data- the training data to be used for generating the classifier.- Throws:
java.lang.Exception- if the classifier could not be built successfully
-
distributionForInstance
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
Calculates the class membership probabilities for the given test instance.- Overrides:
distributionForInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- preedicted class probability distribution
- Throws:
java.lang.Exception- if distribution can't be computed successfully
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv- the options
-
-