All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.attributeSelection.ClassifierSubsetEval

java.lang.Object
   |
   +----weka.attributeSelection.ASEvaluation
           |
           +----weka.attributeSelection.SubsetEvaluator
                   |
                   +----weka.attributeSelection.HoldOutSubsetEvaluator
                           |
                           +----weka.attributeSelection.ClassifierSubsetEval

public class ClassifierSubsetEval
extends HoldOutSubsetEvaluator
implements OptionHandler, ErrorBasedMeritEvaluator
Classifier subset evaluator. Uses a classifier to estimate the "merit" of a set of attributes. Valid options are:

-B
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.NaiveBayes ... -- -K

-T
Use the training data for accuracy estimation rather than a hold out/ test set.

-H
The file containing hold out/test instances to use for accuracy estimation

Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Constructor Index

 o ClassifierSubsetEval()

Method Index

 o buildEvaluator(Instances)
Generates a attribute evaluator.
 o classifierTipText()
Returns the tip text for this property
 o evaluateSubset(BitSet)
Evaluates a subset of attributes
 o evaluateSubset(BitSet, Instance, boolean)
Evaluates a subset of attributes with respect to a single instance.
 o evaluateSubset(BitSet, Instances)
Evaluates a subset of attributes with respect to a set of instances.
 o getClassifier()
Get the classifier used as the base learner.
 o getHoldOutFile()
Gets the file that holds hold out/test instances.
 o getOptions()
Gets the current settings of ClassifierSubsetEval
 o getUseTraining()
Get if training data is to be used instead of hold out/test data
 o globalInfo()
Returns a string describing this attribute evaluator
 o holdOutFileTipText()
Returns the tip text for this property
 o listOptions()
Returns an enumeration describing the available options

-B
Class name of the classifier to use for accuracy estimation.

 o main(String[])
Main method for testing this class.
 o setClassifier(Classifier)
Set the classifier to use for accuracy estimation
 o setHoldOutFile(File)
Set the file that contains hold out/test instances
 o setOptions(String[])
Parses a given list of options.
 o setUseTraining(boolean)
Set if training data is to be used instead of hold out/test data
 o toString()
Returns a string describing classifierSubsetEval
 o useTrainingTipText()
Returns the tip text for this property

Constructors

 o ClassifierSubsetEval
 public ClassifierSubsetEval()

Methods

 o globalInfo
 public String globalInfo()
Returns a string describing this attribute evaluator

Returns:
a description of the evaluator suitable for displaying in the explorer/experimenter gui
 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

-B
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.NaiveBayes ... -- -K

-T
Use the training data for accuracy estimation rather than a hold out/ test set.

-H
The file containing hold out/test instances to use for accuracy estimation

Returns:
an enumeration of all the available options
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-C
Class name of classifier to use for accuracy estimation. Place any classifier options last on the command line following a "--". Eg -B weka.classifiers.NaiveBayes ... -- -K

-T
Use training data instead of a hold out/test set for accuracy estimation.

-H
Name of the hold out/test set to estimate classifier accuracy on.

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o classifierTipText
 public String classifierTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setClassifier
 public void setClassifier(Classifier newClassifier)
Set the classifier to use for accuracy estimation

Parameters:
newClassifier - the Classifier to use.
 o getClassifier
 public Classifier getClassifier()
Get the classifier used as the base learner.

Returns:
the classifier used as the classifier
 o holdOutFileTipText
 public String holdOutFileTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o getHoldOutFile
 public File getHoldOutFile()
Gets the file that holds hold out/test instances.

Returns:
File that contains hold out instances
 o setHoldOutFile
 public void setHoldOutFile(File h)
Set the file that contains hold out/test instances

Parameters:
h - the hold out file
 o useTrainingTipText
 public String useTrainingTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o getUseTraining
 public boolean getUseTraining()
Get if training data is to be used instead of hold out/test data

Returns:
true if training data is to be used instead of hold out data
 o setUseTraining
 public void setUseTraining(boolean t)
Set if training data is to be used instead of hold out/test data

Returns:
true if training data is to be used instead of hold out data
 o getOptions
 public String[] getOptions()
Gets the current settings of ClassifierSubsetEval

Returns:
an array of strings suitable for passing to setOptions()
 o buildEvaluator
 public void buildEvaluator(Instances data) throws Exception
Generates a attribute evaluator. Has to initialize all fields of the evaluator that are not being set via options.

Parameters:
data - set of instances serving as training data
Throws: Exception
if the evaluator has not been generated successfully
Overrides:
buildEvaluator in class ASEvaluation
 o evaluateSubset
 public double evaluateSubset(BitSet subset) throws Exception
Evaluates a subset of attributes

Parameters:
subset - a bitset representing the attribute subset to be evaluated
Throws: Exception
if the subset could not be evaluated
Overrides:
evaluateSubset in class SubsetEvaluator
 o evaluateSubset
 public double evaluateSubset(BitSet subset,
                              Instances holdOut) throws Exception
Evaluates a subset of attributes with respect to a set of instances. Calling this function overides any test/hold out instancs set from setHoldOutFile.

Parameters:
subset - a bitset representing the attribute subset to be evaluated
holdOut - a set of instances (possibly seperate and distinct from those use to build/train the evaluator) with which to evaluate the merit of the subset
Returns:
the "merit" of the subset on the holdOut data
Throws: Exception
if the subset cannot be evaluated
Overrides:
evaluateSubset in class HoldOutSubsetEvaluator
 o evaluateSubset
 public double evaluateSubset(BitSet subset,
                              Instance holdOut,
                              boolean retrain) throws Exception
Evaluates a subset of attributes with respect to a single instance. Calling this function overides any hold out/test instances set through setHoldOutFile.

Parameters:
subset - a bitset representing the attribute subset to be evaluated
holdOut - a single instance (possibly not one of those used to build/train the evaluator) with which to evaluate the merit of the subset
retrain - true if the classifier should be retrained with respect to the new subset before testing on the holdOut instance.
Returns:
the "merit" of the subset on the holdOut instance
Throws: Exception
if the subset cannot be evaluated
Overrides:
evaluateSubset in class HoldOutSubsetEvaluator
 o toString
 public String toString()
Returns a string describing classifierSubsetEval

Returns:
the description as a string
Overrides:
toString in class Object
 o main
 public static void main(String args[])
Main method for testing this class.

Parameters:
args - the options

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home