public class ClassifierSubsetEval extends HoldOutSubsetEvaluator implements OptionHandler, ErrorBasedMeritEvaluator
-B <classifier> class name of the classifier to use for accuracy estimation. Place any classifier options LAST on the command line following a "--". eg.: -B weka.classifiers.bayes.NaiveBayes ... -- -K (default: weka.classifiers.rules.ZeroR)
-T Use the training data to estimate accuracy.
-H <filename> Name of the hold out/test set to estimate accuracy on.
-percentage-split Perform a percentage split on the training data. Use in conjunction with -T.
-P Split percentage to use (default = 90).
-S Random seed for percentage split (default = 1).
-E <DEFAULT|ACC|RMSE|MAE|F-MEAS|AUC|AUPRC|CORR-COEFF> Performance evaluation measure to use for selecting attributes. (Default = default: accuracy for discrete class and rmse for numeric class)
-IRclass <label | index> Optional class value (label or 1-based index) to use in conjunction with IR statistics (f-meas, auc or auprc). Omitting this option will use the class-weighted average.
Options specific to scheme weka.classifiers.rules.ZeroR:
-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).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
Modifier and Type | Field and Description |
---|---|
static int |
EVAL_ACCURACY |
static int |
EVAL_AUC |
static int |
EVAL_AUPRC |
static int |
EVAL_CORRELATION |
static int |
EVAL_DEFAULT |
static int |
EVAL_FMEASURE |
static int |
EVAL_MAE |
static int |
EVAL_PLUGIN |
static int |
EVAL_RMSE |
static Tag[] |
TAGS_EVALUATION
Holds all tags for metrics
|
Constructor and Description |
---|
ClassifierSubsetEval() |
Modifier and Type | Method and Description |
---|---|
void |
buildEvaluator(Instances data)
Generates a attribute evaluator.
|
java.lang.String |
classifierTipText()
Returns the tip text for this property
|
double |
evaluateSubset(java.util.BitSet subset)
Evaluates a subset of attributes
|
double |
evaluateSubset(java.util.BitSet subset,
Instance holdOut,
boolean retrain)
Evaluates a subset of attributes with respect to a single instance.
|
double |
evaluateSubset(java.util.BitSet subset,
Instances holdOut)
Evaluates a subset of attributes with respect to a set of instances.
|
java.lang.String |
evaluationMeasureTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns the capabilities of this evaluator.
|
Classifier |
getClassifier()
Get the classifier used as the base learner.
|
SelectedTag |
getEvaluationMeasure()
Gets the currently set performance evaluation measure used for selecting
attributes for the decision table
|
java.io.File |
getHoldOutFile()
Gets the file that holds hold out/test instances.
|
java.lang.String |
getIRClassValue()
Get the class value (label or index) to use with IR metric evaluation of
subsets.
|
java.lang.String[] |
getOptions()
Gets the current settings of ClassifierSubsetEval
|
java.lang.String |
getRevision()
Returns the revision string.
|
int |
getSeed()
Get the random seed used to randomize the data before performing a
percentage split
|
java.lang.String |
getSplitPercent()
Get the split percentage to use
|
boolean |
getUsePercentageSplit()
Get whether to perform a percentage split on the training data for
evaluation
|
boolean |
getUseTraining()
Get if training data is to be used instead of hold out/test data
|
java.lang.String |
globalInfo()
Returns a string describing this attribute evaluator
|
java.lang.String |
holdOutFileTipText()
Returns the tip text for this property
|
java.lang.String |
IRClassValueTipText()
Returns the tip text for this property
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
Main method for testing this class.
|
java.lang.String |
seedTipText()
Returns the tip text for this property
|
void |
setClassifier(Classifier newClassifier)
Set the classifier to use for accuracy estimation
|
void |
setEvaluationMeasure(SelectedTag newMethod)
Sets the performance evaluation measure to use for selecting attributes for
the decision table
|
void |
setHoldOutFile(java.io.File h)
Set the file that contains hold out/test instances
|
void |
setIRClassValue(java.lang.String val)
Set the class value (label or index) to use with IR metric evaluation of
subsets.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSeed(int s)
Set the random seed used to randomize the data before performing a
percentage split
|
void |
setSplitPercent(java.lang.String sp)
Set the split percentage to use
|
void |
setUsePercentageSplit(boolean p)
Set whether to perform a percentage split on the training data for
evaluation
|
void |
setUseTraining(boolean t)
Set if training data is to be used instead of hold out/test data
|
java.lang.String |
splitPercentTipText()
Returns the tip text for this property
|
java.lang.String |
toString()
Returns a string describing classifierSubsetEval
|
java.lang.String |
usePercentageSplitTipText()
Returns the tip text for this property
|
java.lang.String |
useTrainingTipText()
Returns the tip text for this property
|
clean, doNotCheckCapabilitiesTipText, forName, getDoNotCheckCapabilities, makeCopies, postExecution, postProcess, preExecution, run, runEvaluator, setDoNotCheckCapabilities
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
public static final int EVAL_DEFAULT
public static final int EVAL_ACCURACY
public static final int EVAL_RMSE
public static final int EVAL_MAE
public static final int EVAL_FMEASURE
public static final int EVAL_AUC
public static final int EVAL_AUPRC
public static final int EVAL_CORRELATION
public static final int EVAL_PLUGIN
public static final Tag[] TAGS_EVALUATION
public java.lang.String globalInfo()
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class ASEvaluation
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-B <classifier> class name of the classifier to use for accuracy estimation. Place any classifier options LAST on the command line following a "--". eg.: -B weka.classifiers.bayes.NaiveBayes ... -- -K (default: weka.classifiers.rules.ZeroR)
-T Use the training data to estimate accuracy.
-H <filename> Name of the hold out/test set to estimate accuracy on.
-percentage-split Perform a percentage split on the training data. Use in conjunction with -T.
-P Split percentage to use (default = 90).
-S Random seed for percentage split (default = 1).
-E <DEFAULT|ACC|RMSE|MAE|F-MEAS|AUC|AUPRC|CORR-COEFF> Performance evaluation measure to use for selecting attributes. (Default = default: accuracy for discrete class and rmse for numeric class)
-IRclass <label | index> Optional class value (label or 1-based index) to use in conjunction with IR statistics (f-meas, auc or auprc). Omitting this option will use the class-weighted average.
Options specific to scheme weka.classifiers.rules.ZeroR:
-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).
-num-decimal-places The number of decimal places for the output of numbers in the model (default 2).
-batch-size The desired batch size for batch prediction (default 100).
setOptions
in interface OptionHandler
setOptions
in class ASEvaluation
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String seedTipText()
public void setSeed(int s)
s
- the seed to usepublic int getSeed()
public java.lang.String usePercentageSplitTipText()
public void setUsePercentageSplit(boolean p)
p
- true if a percentage split is to be performedpublic boolean getUsePercentageSplit()
public java.lang.String splitPercentTipText()
public void setSplitPercent(java.lang.String sp)
sp
- the split percentage to usepublic java.lang.String getSplitPercent()
public void setIRClassValue(java.lang.String val)
val
- the class label or 1-based index of the class label to use when
evaluating subsets with an IR metricpublic java.lang.String getIRClassValue()
public java.lang.String IRClassValueTipText()
public java.lang.String evaluationMeasureTipText()
public SelectedTag getEvaluationMeasure()
public void setEvaluationMeasure(SelectedTag newMethod)
newMethod
- the new performance evaluation metric to usepublic java.lang.String classifierTipText()
public void setClassifier(Classifier newClassifier)
newClassifier
- the Classifier to use.public Classifier getClassifier()
public java.lang.String holdOutFileTipText()
public java.io.File getHoldOutFile()
public void setHoldOutFile(java.io.File h)
h
- the hold out filepublic java.lang.String useTrainingTipText()
public boolean getUseTraining()
public void setUseTraining(boolean t)
t
- true if training data is to be used instead of hold out datapublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class ASEvaluation
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class ASEvaluation
Capabilities
public void buildEvaluator(Instances data) throws java.lang.Exception
buildEvaluator
in class ASEvaluation
data
- set of instances serving as training datajava.lang.Exception
- if the evaluator has not been generated successfullypublic double evaluateSubset(java.util.BitSet subset) throws java.lang.Exception
evaluateSubset
in interface SubsetEvaluator
subset
- a bitset representing the attribute subset to be evaluatedjava.lang.Exception
- if the subset could not be evaluatedpublic double evaluateSubset(java.util.BitSet subset, Instances holdOut) throws java.lang.Exception
evaluateSubset
in class HoldOutSubsetEvaluator
subset
- a bitset representing the attribute subset to be evaluatedholdOut
- a set of instances (possibly separate and distinct from
those use to build/train the evaluator) with which to evaluate the
merit of the subsetjava.lang.Exception
- if the subset cannot be evaluatedpublic double evaluateSubset(java.util.BitSet subset, Instance holdOut, boolean retrain) throws java.lang.Exception
evaluateSubset
in class HoldOutSubsetEvaluator
subset
- a bitset representing the attribute subset to be evaluatedholdOut
- a single instance (possibly not one of those used to
build/train the evaluator) with which to evaluate the merit of the
subsetretrain
- true if the classifier should be retrained with respect to
the new subset before testing on the holdOut instance.java.lang.Exception
- if the subset cannot be evaluatedpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class ASEvaluation
public static void main(java.lang.String[] args)
args
- the options