public class IterativeClassifierOptimizer extends RandomizableClassifier implements AdditionalMeasureProducer
-A If set, average estimate is used rather than one estimate from pooled predictions.
-L <num> The number of iterations to look ahead for to find a better optimum. (default 50)
-P <int> The size of the thread pool, for example, the number of cores in the CPU. (default 1)
-E <int> The number of threads to use, which should be >= size of thread pool. (default 1)
-I <num> Step size for the evaluation, if evaluation is time consuming. (default 1)
-F <num> Number of folds for cross-validation. (default 10)
-R <num> Number of runs for cross-validation. (default 1)
-W Full name of base classifier. (default: weka.classifiers.meta.LogitBoost)
-metric <name> Evaluation metric to optimise (default rmse). Available metrics: correct,incorrect,kappa,total cost,average cost,kb relative,kb information, correlation,complexity 0,complexity scheme,complexity improvement, mae,rmse,rae,rrse,coverage,region size,tp rate,fp rate,precision,recall, f-measure,mcc,roc area,prc area
-class-value-index <0-based index> Class value index to optimise. Ignored for all but information-retrieval type metrics (such as roc area). If unspecified (or a negative value is supplied), and an information-retrieval metric is specified, then the class-weighted average metric used. (default -1)
-S <num> Random number seed. (default 1)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.meta.LogitBoost:
-Q Use resampling instead of reweighting for boosting.
-P <percent> Percentage of weight mass to base training on. (default 100, reduce to around 90 speed up)
-L <num> Threshold on the improvement of the likelihood. (default -Double.MAX_VALUE)
-H <num> Shrinkage parameter. (default 1)
-Z <num> Z max threshold for responses. (default 3)
-O <int> The size of the thread pool, for example, the number of cores in the CPU. (default 1)
-E <int> The number of threads to use for batch prediction, which should be >= size of thread pool. (default 1)
-S <num> Random number seed. (default 1)
-I <num> Number of iterations. (default 10)
-percentage <num> The percentage of data to be used for training (if 0, k-fold cross-validation is used). (default 0)
-order Whether to preserve order when a percentage split evaluation is performed.
-W Full name of base classifier. (default: weka.classifiers.trees.DecisionStump)
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.trees.DecisionStump:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
| Modifier and Type | Field and Description |
|---|---|
protected int |
m_bestNumIts
The best number of iterations identified.
|
protected double |
m_bestResult
The best value found for the criterion to be optimized.
|
protected int |
m_classValueIndex
The class value index to use with information retrieval type metrics. < 0
indicates to use the class weighted average version of the metric".
|
protected java.lang.String |
m_evalMetric
The evaluation metric to use
|
protected IterativeClassifier |
m_IterativeClassifier
The base classifier to use
|
protected int |
m_lookAheadIterations
The number of iterations to look ahead for to find a better optimum.
|
protected int |
m_NumFolds
The number of folds for the cross-validation.
|
protected int |
m_NumRuns
The number of runs for the cross-validation.
|
protected int |
m_numThreads
The number of threads to use for parallel building of classifiers.
|
protected int |
m_poolSize
The size of the thread pool.
|
protected boolean |
m_preserveOrderInPercentageSplitEvaluation
Whether to preserve order when a percentage split evaluation is performed.
|
protected double |
m_splitPercentage
The percentage of data to be used for training (if 0, k-fold cross-validation is used).
|
protected int |
m_StepSize
The steps size determining when evaluations happen.
|
protected double[] |
m_thresholds
The thresholds to be used for classification, if the metric implements
ThresholdProducingMetric.
|
protected boolean |
m_UseAverage
Whether to use average.
|
static Tag[] |
TAGS_EVAL |
m_SeedBATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULT| Constructor and Description |
|---|
IterativeClassifierOptimizer() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(Instances data)
Builds the classifier.
|
java.lang.String |
classValueIndexTipText()
Returns the tip text for this property
|
protected java.lang.String |
defaultIterativeClassifierString()
String describing default classifier.
|
double[] |
distributionForInstance(Instance inst)
Returns the class distribution for an instance.
|
java.util.Enumeration<java.lang.String> |
enumerateMeasures()
Returns an enumeration of the additional measure names
|
java.lang.String |
evaluationMetricTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns default capabilities of the base classifier.
|
int |
getClassValueIndex()
Get the class value index to use
|
SelectedTag |
getEvaluationMetric()
Get the evaluation metric to use
|
IterativeClassifier |
getIterativeClassifier()
Get the classifier used as the base learner.
|
protected IterativeClassifier |
getIterativeClassifier(java.lang.String name,
java.lang.String[] options)
Get classifier for string.
|
protected java.lang.String |
getIterativeClassifierSpec()
Gets the classifier specification string, which contains the class name of
the classifier and any options to the classifier
|
int |
getLookAheadIterations()
Get the value of LookAheadIterations.
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure
|
int |
getNumFolds()
Get the value of NumFolds.
|
int |
getNumRuns()
Get the value of NumRuns.
|
int |
getNumThreads()
Gets the number of threads.
|
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier.
|
int |
getPoolSize()
Gets the number of threads.
|
boolean |
getPreserveOrderInPercentageSplitEvaluation()
Get the value of PreserveOrderInPercentageSplitEvaluation.
|
java.lang.String |
getRevision()
Returns the revision string.
|
double |
getSplitPercentage()
Get the value of SplitPercentage.
|
int |
getStepSize()
Get the value of StepSize.
|
boolean |
getUseAverage()
Get the value of UseAverage.
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.lang.String |
iterativeClassifierTipText()
Returns the tip text for this property
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
java.lang.String |
lookAheadIterationsTipText()
Returns the tip text for this property
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
double |
measureBestNumIts()
Returns the best number of iterations
|
double |
measureBestVal()
Returns the measure for the best model
|
java.lang.String |
numFoldsTipText()
Returns the tip text for this property
|
java.lang.String |
numRunsTipText()
Returns the tip text for this property
|
java.lang.String |
numThreadsTipText() |
java.lang.String |
poolSizeTipText() |
java.lang.String |
preserveOrderInPercentageSplitEvaluationTipText()
Returns the tip text for this property
|
void |
setClassValueIndex(int i)
Set the class value index to use
|
void |
setEvaluationMetric(SelectedTag metric)
Set the evaluation metric to use
|
void |
setIterativeClassifier(IterativeClassifier newIterativeClassifier)
Set the base learner.
|
void |
setLookAheadIterations(int newLookAheadIterations)
Set the value of LookAheadIterations.
|
void |
setNumFolds(int newNumFolds)
Set the value of NumFolds.
|
void |
setNumRuns(int newNumRuns)
Set the value of NumRuns.
|
void |
setNumThreads(int nT)
Sets the number of threads
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setPoolSize(int nT)
Sets the number of threads
|
void |
setPreserveOrderInPercentageSplitEvaluation(boolean newPreserveOrderInPercentageSplitEvaluation)
Set the value of PreserveOrderInPercentageSplitEvaluation.
|
void |
setSplitPercentage(double newSplitPercentage)
Set the value of SplitPercentage.
|
void |
setStepSize(int newStepSize)
Set the value of StepSize.
|
void |
setUseAverage(boolean newUseAverage)
Set the value of UseAverage.
|
java.lang.String |
splitPercentageTipText()
Returns the tip text for this property
|
java.lang.String |
stepSizeTipText()
Returns the tip text for this property
|
java.lang.String |
toString()
Returns a string describing the classifier.
|
java.lang.String |
useAverageTipText()
Returns the tip text for this property
|
getSeed, seedTipText, setSeedbatchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlacesprotected IterativeClassifier m_IterativeClassifier
protected int m_NumFolds
protected int m_NumRuns
protected int m_StepSize
protected boolean m_UseAverage
protected int m_lookAheadIterations
public static Tag[] TAGS_EVAL
protected java.lang.String m_evalMetric
protected int m_classValueIndex
protected double[] m_thresholds
protected double m_bestResult
protected int m_bestNumIts
protected int m_numThreads
protected int m_poolSize
protected double m_splitPercentage
protected boolean m_preserveOrderInPercentageSplitEvaluation
public java.lang.String globalInfo()
protected java.lang.String defaultIterativeClassifierString()
public java.lang.String useAverageTipText()
public boolean getUseAverage()
public void setUseAverage(boolean newUseAverage)
newUseAverage - Value to assign to UseAverage.public java.lang.String numThreadsTipText()
public int getNumThreads()
public void setNumThreads(int nT)
public java.lang.String poolSizeTipText()
public int getPoolSize()
public void setPoolSize(int nT)
public java.lang.String stepSizeTipText()
public int getStepSize()
public void setStepSize(int newStepSize)
newStepSize - Value to assign to StepSize.public java.lang.String numRunsTipText()
public int getNumRuns()
public void setNumRuns(int newNumRuns)
newNumRuns - Value to assign to NumRuns.public java.lang.String numFoldsTipText()
public int getNumFolds()
public void setNumFolds(int newNumFolds)
newNumFolds - Value to assign to NumFolds.public java.lang.String lookAheadIterationsTipText()
public int getLookAheadIterations()
public void setLookAheadIterations(int newLookAheadIterations)
newLookAheadIterations - Value to assign to LookAheadIterations.public java.lang.String splitPercentageTipText()
public double getSplitPercentage()
public void setSplitPercentage(double newSplitPercentage)
newSplitPercentage - Value to assign to SplitPercentage.public java.lang.String preserveOrderInPercentageSplitEvaluationTipText()
public boolean getPreserveOrderInPercentageSplitEvaluation()
public void setPreserveOrderInPercentageSplitEvaluation(boolean newPreserveOrderInPercentageSplitEvaluation)
newPreserveOrderInPercentageSplitEvaluation - Value to assign to PreserveOrderInPercentageSplitEvaluation.public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier in interface Classifierdata - set of instances serving as training datajava.lang.Exception - if the classifier has not been
generated successfullypublic double[] distributionForInstance(Instance inst) throws java.lang.Exception
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinst - the instance to be classifiedjava.lang.Exception - if distribution could not be computed successfullypublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class RandomizableClassifierpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
setOptions in interface OptionHandlersetOptions in class RandomizableClassifieroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedprotected IterativeClassifier getIterativeClassifier(java.lang.String name, java.lang.String[] options) throws java.lang.Exception
java.lang.Exception - if a problem occurspublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class RandomizableClassifierpublic java.lang.String evaluationMetricTipText()
public void setEvaluationMetric(SelectedTag metric)
metric - the metric to usepublic SelectedTag getEvaluationMetric()
public java.lang.String classValueIndexTipText()
public void setClassValueIndex(int i)
i - the class value index to usepublic int getClassValueIndex()
public java.lang.String iterativeClassifierTipText()
public Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class AbstractClassifierCapabilitiespublic void setIterativeClassifier(IterativeClassifier newIterativeClassifier)
newIterativeClassifier - the classifier to use.public IterativeClassifier getIterativeClassifier()
protected java.lang.String getIterativeClassifierSpec()
public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic double measureBestNumIts()
public double measureBestVal()
public java.util.Enumeration<java.lang.String> enumerateMeasures()
enumerateMeasures in interface AdditionalMeasureProducerpublic double getMeasure(java.lang.String additionalMeasureName)
getMeasure in interface AdditionalMeasureProduceradditionalMeasureName - the name of the measure to query for its valuejava.lang.IllegalArgumentException - if the named measure is not supportedpublic static void main(java.lang.String[] argv)
argv - the options