|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.meta.Crate
CRATE (Committee Regressor using Artificial Training Examples) is a meta-learner for building diverse ensembles of regressors by adding specially constructed artificial training examples. Comprehensive experiments have demonstrated that this technique is consistently more accurate than bagging and more accurate that boosting when training data is limited. For more details see
Prem Melville and Raymond J. Mooney. Constructing diverse
classifier ensembles using artificial training examples.
Proceedings of the Seventeeth International Joint Conference on
Artificial Intelligence 2003.
Valid options are:
-D
Turn on debugging output.
-W classname
Specify the full class name of a weak classifier as the basis for
Crate (default weka.classifiers.trees.j48.J48()).
-I num
Specify the desired size of the committee (default 15).
-M iterations
Set the maximum number of Crate iterations (default 50).
-S seed
Seed for random number generator. (default 0).
-R factor
Factor that determines number of artificial examples to generate.
Options after -- are passed to the designated classifier.
Field Summary | |
protected double |
m_Alpha
Factor specifying desired amount of diversity |
protected double |
m_ArtSize
Amount of artificial/random instances to use - specified as a fraction of the training data size. |
protected java.util.Vector |
m_AttributeStats
Attribute statistics - used for generating artificial examples. |
protected Classifier |
m_Classifier
The model base classifier to use. |
protected java.util.Vector |
m_Committee
Vector of classifiers that make up the committee/ensemble. |
protected boolean |
m_Debug
Set to true to get debugging output. |
protected int |
m_DesiredSize
The desired ensemble size. |
protected int |
m_ErrorMeasure
Error measure to optimize for |
protected Evaluation |
m_Evaluation
Evaluator |
protected int |
m_NumIterations
The maximum number of Crate iterations to run. |
protected java.util.Random |
m_Random
The random number generator. |
protected int |
m_Seed
The seed for random number generation. |
Constructor Summary | |
Crate()
|
Method Summary | |
protected void |
addInstances(Instances data,
Instances newData)
Add new instances to the given set of instances. |
void |
buildClassifier(Instances data)
Build Crate classifier |
double |
classifyInstance(Instance instance)
Classifies a given instance. |
protected double |
computeError(Instances data)
Computes the error in prediction on the given data. |
protected void |
computeStats(Instances data)
Compute and store statistics required for generating artificial data. |
protected Instances |
generateArtificialData(int artSize,
Instances data)
Generate artificial training examples. |
double |
getAlpha()
Get the value of Alpha. |
double |
getArtificialSize()
Factor that determines number of artificial examples to generate. |
Classifier |
getClassifier()
Get the classifier used as the base classifier |
boolean |
getDebug()
Get whether debugging is turned on |
int |
getDesiredSize()
Gets the desired size of the committee. |
int |
getErrorMeasure()
Get the value of errorMeasure. |
int |
getNumIterations()
Gets the max number of Crate iterations to run. |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
int |
getSeed()
Gets the seed for the random number generator. |
protected void |
labelData(Instances artData)
Labels the artificially generated data. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
protected void |
removeInstances(Instances data,
int numRemove)
Removes a specified number of instances from the given set of instances. |
protected int |
selectIndexProbabilistically(double[] cdf)
Given cumulative probabilities select a nominal attribute value index |
void |
setAlpha(double v)
Set the value of Alpha. |
void |
setArtificialSize(double newArtSize)
Sets factor that determines number of artificial examples to generate. |
void |
setClassifier(Classifier newClassifier)
Set the base classifier for Crate. |
void |
setDebug(boolean debug)
Set debugging mode |
void |
setDesiredSize(int newDesiredSize)
Sets the desired size of the committee. |
void |
setErrorMeasure(int v)
Set the value of errorMeasure. |
void |
setNumIterations(int numIterations)
Sets the max number of Crate iterations to run. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setSeed(int seed)
Set the seed for random number generator. |
java.lang.String |
toString()
Returns description of the Crate classifier. |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean m_Debug
protected Classifier m_Classifier
protected java.util.Vector m_Committee
protected int m_DesiredSize
protected int m_NumIterations
protected int m_Seed
protected double m_ArtSize
protected java.util.Random m_Random
protected java.util.Vector m_AttributeStats
protected double m_Alpha
protected Evaluation m_Evaluation
protected int m_ErrorMeasure
Constructor Detail |
public Crate()
Method Detail |
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D
Turn on debugging output.
-W classname
Specify the full class name of a weak classifier as the basis for
Crate (required).
-I num
Specify the desired size of the committee (default 15).
-M iterations
Set the maximum number of Crate iterations (default 50).
-S seed
Seed for random number generator. (default 0).
-R factor
Factor that determines number of artificial examples to generate.
Options after -- are passed to the designated classifier.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public int getErrorMeasure()
public void setErrorMeasure(int v)
v
- Value to assign to errorMeasure.public double getAlpha()
public void setAlpha(double v)
v
- Value to assign to Alpha.public void setDebug(boolean debug)
debug
- true if debug output should be printedpublic boolean getDebug()
public void setClassifier(Classifier newClassifier)
newClassifier
- the Classifier to use.public Classifier getClassifier()
public double getArtificialSize()
public void setArtificialSize(double newArtSize)
public int getDesiredSize()
public void setDesiredSize(int newDesiredSize)
newDesiredSize
- the desired size of the committeepublic void setNumIterations(int numIterations)
numIterations
- max number of Crate iterations to runpublic int getNumIterations()
public void setSeed(int seed)
seed
- the random number seedpublic int getSeed()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data to be used for generating the classifier
java.lang.Exception
- if the classifier could not be built successfullyprotected void computeStats(Instances data) throws java.lang.Exception
data
- training instances
java.lang.Exception
- if statistics could not be calculated successfullyprotected Instances generateArtificialData(int artSize, Instances data)
artSize
- size of examples set to createdata
- training data
protected int selectIndexProbabilistically(double[] cdf)
cdf
- array of cumulative probabilities
protected void labelData(Instances artData) throws java.lang.Exception
artData
- the artificially generated instances
java.lang.Exception
- if instances cannot be labeled successfullyprotected void removeInstances(Instances data, int numRemove)
data
- given instancesnumRemove
- number of instances to delete from the given instancesprotected void addInstances(Instances data, Instances newData)
data
- given instancesnewData
- set of instances to add to given instancesprotected double computeError(Instances data) throws java.lang.Exception
data
- the instances to be classified
java.lang.Exception
- if error can not be computed successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if instance could not be predicted successfullypublic java.lang.String toString()
public static void main(java.lang.String[] argv)
argv
- the options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |