Package weka.attributeSelection
Class ClassifierAttributeEval
- java.lang.Object
-
- weka.attributeSelection.ASEvaluation
-
- weka.attributeSelection.ClassifierAttributeEval
-
- All Implemented Interfaces:
java.io.Serializable,AttributeEvaluator,CapabilitiesHandler,CapabilitiesIgnorer,CommandlineRunnable,OptionHandler,RevisionHandler
public class ClassifierAttributeEval extends ASEvaluation implements AttributeEvaluator, OptionHandler
ClassifierAttributeEval :
Evaluates the worth of an attribute by using a user-specified classifier.
Valid options are:-L Evaluate an attribute by measuring the impact of leaving it out from the full set instead of considering its worth in isolation
-B <base learner> class name of base learner 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)
-F <num> number of cross validation folds to use for estimating accuracy. (default=5)
-R <seed> Seed for cross validation accuracy testimation. (default = 1)
-T <num> threshold by which to execute another cross validation (standard deviation---expressed as a percentage of the mean). (default: 0.01 (1%))
-E <acc | rmse | mae | f-meas | auc | auprc> Performance evaluation measure to use for selecting attributes. (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).
-execution-slots <integer> Number of attributes to evaluate in parallel. Default = 1 (i.e. no parallelism)
- Version:
- $Revision: 14195 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ClassifierAttributeEval()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildEvaluator(Instances data)Initializes a ClassifierAttribute attribute evaluator.java.lang.StringclassifierTipText()Returns the tip text for this propertydoubleevaluateAttribute(int attribute)Evaluates an individual attribute by measuring the amount of information gained about the class given the attribute.java.lang.StringevaluationMeasureTipText()Returns the tip text for this propertyjava.lang.StringfoldsTipText()Returns the tip text for this propertyCapabilitiesgetCapabilities()Returns the capabilities of this evaluator.ClassifiergetClassifier()Get the classifier used as the base learner.SelectedTaggetEvaluationMeasure()Gets the currently set performance evaluation measure used for selecting attributes for the decision tableintgetFolds()Get the number of folds used for accuracy estimationjava.lang.StringgetIRClassValue()Get the class value (label or index) to use with IR metric evaluation of subsets.booleangetLeaveOneAttributeOut()Get whether to evaluate the merit of an attribute based on the impact of leaving it out from the full set instead of considering its worth in isolationintgetNumToEvaluateInParallel()Get the number of attributes to evaluate in paralleljava.lang.String[]getOptions()returns the current setup.java.lang.StringgetRevision()Returns the revision string.intgetSeed()Get the random number seed used for cross validationdoublegetThreshold()Get the value of the thresholdjava.lang.StringglobalInfo()Returns a string describing this attribute evaluator.java.lang.StringIRClassValueTipText()Returns the tip text for this propertyjava.lang.StringleaveOneAttributeOutTipText()Tip text for this propertyjava.util.Enumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] args)Main method for executing this class.java.lang.StringnumToEvaluateInParallelTipText()Tip text for this property.java.lang.StringseedTipText()Returns the tip text for this propertyvoidsetClassifier(Classifier newClassifier)Set the classifier to use for accuracy estimationvoidsetEvaluationMeasure(SelectedTag newMethod)Sets the performance evaluation measure to use for selecting attributes for the decision tablevoidsetFolds(int f)Set the number of folds to use for accuracy estimationvoidsetIRClassValue(java.lang.String val)Set the class value (label or index) to use with IR metric evaluation of subsets.voidsetLeaveOneAttributeOut(boolean l)Set whether to evaluate the merit of an attribute based on the impact of leaving it out from the full set instead of considering its worth in isolationvoidsetNumToEvaluateInParallel(int n)Set the number of attributes to evaluate in parallelvoidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetSeed(int s)Set the seed to use for cross validationvoidsetThreshold(double t)Set the value of the threshold for repeating cross validationjava.lang.StringthresholdTipText()Returns the tip text for this propertyjava.lang.StringtoString()Return a description of the evaluator.-
Methods inherited from class weka.attributeSelection.ASEvaluation
clean, doNotCheckCapabilitiesTipText, forName, getDoNotCheckCapabilities, makeCopies, postExecution, postProcess, preExecution, run, runEvaluator, setDoNotCheckCapabilities
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing this attribute evaluator.- Returns:
- a description of the evaluator suitable for displaying in the explorer/experimenter gui
-
listOptions
public java.util.Enumeration<Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- 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:-B <base learner> class name of base learner 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)
-F <num> number of cross validation folds to use for estimating accuracy. (default=5)
-R <seed> Seed for cross validation accuracy testimation. (default = 1)
-T <num> threshold by which to execute another cross validation (standard deviation---expressed as a percentage of the mean). (default: 0.01 (1%))
-E <acc | rmse | mae | f-meas | auc | auprc> Performance evaluation measure to use for selecting attributes. (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).
-L Evaluate an attribute by measuring the impact of leaving it out from the full set instead of considering its worth in isolation
-execution-slots <integer> Number of attributes to evaluate in parallel. Default = 1 (i.e. no parallelism)
- Specified by:
setOptionsin interfaceOptionHandler- 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()
returns the current setup.- Specified by:
getOptionsin interfaceOptionHandler- Returns:
- the options of the current setup
-
leaveOneAttributeOutTipText
public java.lang.String leaveOneAttributeOutTipText()
Tip text for this property- Returns:
- the tip text for this property
-
setLeaveOneAttributeOut
public void setLeaveOneAttributeOut(boolean l)
Set whether to evaluate the merit of an attribute based on the impact of leaving it out from the full set instead of considering its worth in isolation- Parameters:
l- true if each attribute should be evaluated by measuring the impact of leaving it out from the full set
-
getLeaveOneAttributeOut
public boolean getLeaveOneAttributeOut()
Get whether to evaluate the merit of an attribute based on the impact of leaving it out from the full set instead of considering its worth in isolation- Returns:
- true if each attribute should be evaluated by measuring the impact of leaving it out from the full set
-
numToEvaluateInParallelTipText
public java.lang.String numToEvaluateInParallelTipText()
Tip text for this property.- Returns:
- the tip text for this property
-
setNumToEvaluateInParallel
public void setNumToEvaluateInParallel(int n)
Set the number of attributes to evaluate in parallel- Parameters:
n- the number of attributes to evaluate in parallel
-
getNumToEvaluateInParallel
public int getNumToEvaluateInParallel()
Get the number of attributes to evaluate in parallel- Returns:
- the number of attributes to evaluate in parallel
-
setIRClassValue
public void setIRClassValue(java.lang.String val)
Set the class value (label or index) to use with IR metric evaluation of subsets. Leaving this unset will result in the class weighted average for the IR metric being used.- Parameters:
val- the class label or 1-based index of the class label to use when evaluating subsets with an IR metric
-
getIRClassValue
public java.lang.String getIRClassValue()
Get the class value (label or index) to use with IR metric evaluation of subsets. Leaving this unset will result in the class weighted average for the IR metric being used.- Returns:
- the class label or 1-based index of the class label to use when evaluating subsets with an IR metric
-
IRClassValueTipText
public java.lang.String IRClassValueTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
evaluationMeasureTipText
public java.lang.String evaluationMeasureTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getEvaluationMeasure
public SelectedTag getEvaluationMeasure()
Gets the currently set performance evaluation measure used for selecting attributes for the decision table- Returns:
- the performance evaluation measure
-
setEvaluationMeasure
public void setEvaluationMeasure(SelectedTag newMethod)
Sets the performance evaluation measure to use for selecting attributes for the decision table- Parameters:
newMethod- the new performance evaluation metric to use
-
thresholdTipText
public java.lang.String thresholdTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setThreshold
public void setThreshold(double t)
Set the value of the threshold for repeating cross validation- Parameters:
t- the value of the threshold
-
getThreshold
public double getThreshold()
Get the value of the threshold- Returns:
- the threshold as a double
-
foldsTipText
public java.lang.String foldsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setFolds
public void setFolds(int f)
Set the number of folds to use for accuracy estimation- Parameters:
f- the number of folds
-
getFolds
public int getFolds()
Get the number of folds used for accuracy estimation- Returns:
- the number of folds
-
seedTipText
public java.lang.String seedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int s)
Set the seed to use for cross validation- Parameters:
s- the seed
-
getSeed
public int getSeed()
Get the random number seed used for cross validation- Returns:
- the seed
-
classifierTipText
public java.lang.String classifierTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setClassifier
public void setClassifier(Classifier newClassifier)
Set the classifier to use for accuracy estimation- Parameters:
newClassifier- the Classifier to use.
-
getClassifier
public Classifier getClassifier()
Get the classifier used as the base learner.- Returns:
- the classifier used as the classifier
-
getCapabilities
public Capabilities getCapabilities()
Returns the capabilities of this evaluator.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classASEvaluation- Returns:
- the capabilities of this evaluator
- See Also:
Capabilities
-
buildEvaluator
public void buildEvaluator(Instances data) throws java.lang.Exception
Initializes a ClassifierAttribute attribute evaluator.- Specified by:
buildEvaluatorin classASEvaluation- Parameters:
data- set of instances serving as training data- Throws:
java.lang.Exception- if the evaluator has not been generated successfully
-
evaluateAttribute
public double evaluateAttribute(int attribute) throws java.lang.ExceptionEvaluates an individual attribute by measuring the amount of information gained about the class given the attribute.- Specified by:
evaluateAttributein interfaceAttributeEvaluator- Parameters:
attribute- the index of the attribute to be evaluated- Returns:
- the evaluation
- Throws:
java.lang.Exception- if the attribute could not be evaluated
-
toString
public java.lang.String toString()
Return a description of the evaluator.- Overrides:
toStringin classjava.lang.Object- Returns:
- description as a string
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classASEvaluation- Returns:
- the revision
-
main
public static void main(java.lang.String[] args)
Main method for executing this class.- Parameters:
args- the options
-
-