public class RotationForest extends RandomizableIteratedSingleClassifierEnhancer implements WeightedInstancesHandler, TechnicalInformationHandler
@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).
Modifier and Type | Field and Description |
---|---|
protected int[][][] |
m_Groups
The attributes of each group
|
protected Instances[] |
m_Headers
Headers of the transformed dataset
|
protected int |
m_MaxGroup
The maximum size of a group
|
protected int |
m_MinGroup
The minimum size of a group
|
protected Normalize |
m_Normalize
Filter that normalized the attributes
|
protected boolean |
m_NumberOfGroups
Whether minGroup and maxGroup refer to the number of groups or their
size
|
protected Filter |
m_ProjectionFilter
The type of projection filter
|
protected Filter[][] |
m_ProjectionFilters
The projection filters
|
protected Instances[][] |
m_ReducedHeaders
Headers of the reduced datasets
|
protected int |
m_RemovedPercentage
The percentage of instances to be removed
|
protected RemoveUseless |
m_RemoveUseless
Filter that remove useless attributes
|
m_Seed
m_Classifiers, m_NumIterations
m_Classifier
m_Debug
Constructor and Description |
---|
RotationForest()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addRandomInstances(Instances dataset,
int numInstances,
Random random)
Adds random instances to the dataset.
|
protected int[] |
attributesPermutation(int numAttributes,
int classAttribute,
Random random)
generates a permutation of the attributes.
|
void |
buildClassifier(Instances data)
builds the classifier.
|
protected void |
checkMinMax(Instances data)
Checks m_MinGroup and m_MaxGroup
|
protected Instance |
convertInstance(Instance instance,
int i)
Transforms an instance for the i-th classifier.
|
protected String |
defaultClassifierString()
String describing default classifier.
|
protected Filter |
defaultFilter()
Default projection method.
|
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test
instance.
|
protected void |
generateGroupsFromNumbers(Instances data,
Random random)
generates the groups of attributes, given their minimum and maximum
numbers.
|
protected void |
generateGroupsFromSizes(Instances data,
Random random)
generates the groups of attributes, given their minimum and maximum
sizes.
|
int |
getMaxGroup()
Gets the maximum size of a group.
|
int |
getMinGroup()
Gets the minimum size of a group.
|
boolean |
getNumberOfGroups()
Get whether minGroup and maxGroup refer to the number of groups or their
size
|
String[] |
getOptions()
Gets the current settings of the Classifier.
|
Filter |
getProjectionFilter()
Gets the filter used to project the data.
|
protected String |
getProjectionFilterSpec()
Gets the filter specification string, which contains the class name of
the filter and any options to the filter
|
int |
getRemovedPercentage()
Gets the percentage of instances to be removed
|
String |
getRevision()
Returns the revision string.
|
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.
|
String |
globalInfo()
Returns a string describing classifier
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class.
|
String |
maxGroupTipText()
Returns the tip text for this property
|
String |
minGroupTipText()
Returns the tip text for this property
|
String |
numberOfGroupsTipText()
Returns the tip text for this property
|
protected void |
permute(int[] v,
Random random)
permutes the elements of a given array.
|
protected void |
printGroups()
prints the groups.
|
String |
projectionFilterTipText()
Returns the tip text for this property
|
String |
removedPercentageTipText()
Returns the tip text for this property
|
protected boolean[] |
selectClasses(int numClasses,
Random random)
Selects a non-empty subset of the classes
|
void |
setMaxGroup(int maxGroup)
Sets the maximum size of a group.
|
void |
setMinGroup(int minGroup)
Sets the minimum size of a group.
|
void |
setNumberOfGroups(boolean numberOfGroups)
Set whether minGroup and maxGroup refer to the number of groups or their
size
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setProjectionFilter(Filter projectionFilter)
Sets the filter used to project the data.
|
void |
setRemovedPercentage(int removedPercentage)
Sets the percentage of instance to be removed
|
String |
toString()
Returns description of the Rotation Forest classifier.
|
getSeed, seedTipText, setSeed
getNumIterations, numIterationsTipText, setNumIterations
classifierTipText, getCapabilities, getClassifier, getClassifierSpec, setClassifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
protected int m_MinGroup
protected int m_MaxGroup
protected boolean m_NumberOfGroups
protected int m_RemovedPercentage
protected int[][][] m_Groups
protected Filter m_ProjectionFilter
protected Filter[][] m_ProjectionFilters
protected Instances[] m_Headers
protected Instances[][] m_ReducedHeaders
protected RemoveUseless m_RemoveUseless
protected Normalize m_Normalize
protected Filter defaultFilter()
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
protected String defaultClassifierString()
defaultClassifierString
in class SingleClassifierEnhancer
public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class RandomizableIteratedSingleClassifierEnhancer
public void setOptions(String[] options) throws Exception
-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).
setOptions
in interface OptionHandler
setOptions
in class RandomizableIteratedSingleClassifierEnhancer
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class RandomizableIteratedSingleClassifierEnhancer
public String numberOfGroupsTipText()
public void setNumberOfGroups(boolean numberOfGroups)
numberOfGroups
- whether minGroup and maxGroup refer to the number
of groups or their sizepublic boolean getNumberOfGroups()
public String minGroupTipText()
public void setMinGroup(int minGroup) throws IllegalArgumentException
minGroup
- the minimum value.
of attributes.IllegalArgumentException
public int getMinGroup()
public String maxGroupTipText()
public void setMaxGroup(int maxGroup) throws IllegalArgumentException
maxGroup
- the maximum value.
of attributes.IllegalArgumentException
public int getMaxGroup()
public String removedPercentageTipText()
public void setRemovedPercentage(int removedPercentage) throws IllegalArgumentException
removedPercentage
- the percentage.IllegalArgumentException
public int getRemovedPercentage()
public String projectionFilterTipText()
public void setProjectionFilter(Filter projectionFilter)
projectionFilter
- the filter.public Filter getProjectionFilter()
protected String getProjectionFilterSpec()
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public void buildClassifier(Instances data) throws Exception
buildClassifier
in class IteratedSingleClassifierEnhancer
data
- the training data to be used for generating the
classifier.Exception
- if the classifier could not be built successfullyprotected void addRandomInstances(Instances dataset, int numInstances, Random random)
dataset
- the datasetnumInstances
- the number of instancesrandom
- a random number generatorprotected void checkMinMax(Instances data)
data
- the datasetprotected boolean[] selectClasses(int numClasses, Random random)
numClasses
- the number of classesrandom
- the random number generator.protected void generateGroupsFromSizes(Instances data, Random random)
data
- the training data to be used for generating the
groups.random
- the random number generator.protected void generateGroupsFromNumbers(Instances data, Random random)
data
- the training data to be used for generating the
groups.random
- the random number generator.protected int[] attributesPermutation(int numAttributes, int classAttribute, Random random)
numAttributes
- the number of attributes.classAttributes
- the index of the class attribute.random
- the random number generator.protected void permute(int[] v, Random random)
v
- the array to permuterandom
- the random number generator.protected void printGroups()
protected Instance convertInstance(Instance instance, int i) throws Exception
instance
- the instance to be transformedi
- the base classifier numberException
- if the instance can't be converted successfullypublic double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance
in class Classifier
instance
- the instance to be classifiedException
- if distribution can't be computed successfullypublic static void main(String[] argv)
argv
- the optionsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.