weka.experiment
Class CostSensitiveClassifierSplitEvaluator

java.lang.Object
  extended byweka.experiment.ClassifierSplitEvaluator
      extended byweka.experiment.CostSensitiveClassifierSplitEvaluator
All Implemented Interfaces:
AdditionalMeasureProducer, OptionHandler, java.io.Serializable, SplitEvaluator

public class CostSensitiveClassifierSplitEvaluator
extends ClassifierSplitEvaluator

A SplitEvaluator that produces results for a classification scheme on a nominal class attribute, including weighted misclassification costs.

Version:
$Revision: 1.9 $
Author:
Len Trigg (len@reeltwo.com)
See Also:
Serialized Form

Field Summary
protected  java.io.File m_OnDemandDirectory
          The directory used when loading cost files on demand, null indicates current directory
private static int RESULT_SIZE
          The length of a result
 
Fields inherited from class weka.experiment.ClassifierSplitEvaluator
m_AdditionalMeasures, m_Classifier, m_ClassifierOptions, m_ClassifierVersion, m_doesProduce, m_numberAdditionalMeasures, m_result
 
Constructor Summary
CostSensitiveClassifierSplitEvaluator()
           
 
Method Summary
 java.io.File getOnDemandDirectory()
          Returns the directory that will be searched for cost files when loading on demand.
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 java.lang.Object[] getResult(Instances train, Instances test)
          Gets the results for the supplied train and test datasets.
 java.lang.String[] getResultNames()
          Gets the names of each of the result columns produced for a single run.
 java.lang.Object[] getResultTypes()
          Gets the data types of each of the result columns produced for a single run.
 java.lang.String globalInfo()
          Returns a string describing this split evaluator
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options..
 java.lang.String onDemandDirectoryTipText()
          Returns the tip text for this property
 void setOnDemandDirectory(java.io.File newDir)
          Sets the directory that will be searched for cost files when loading on demand.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Returns a text description of the split evaluator.
 
Methods inherited from class weka.experiment.ClassifierSplitEvaluator
classifierTipText, enumerateMeasures, getClassForIRStatistics, getClassifier, getKey, getKeyNames, getKeyTypes, getMeasure, getRawResultOutput, setAdditionalMeasures, setClassForIRStatistics, setClassifier, setClassifierName, updateOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_OnDemandDirectory

protected java.io.File m_OnDemandDirectory
The directory used when loading cost files on demand, null indicates current directory


RESULT_SIZE

private static final int RESULT_SIZE
The length of a result

See Also:
Constant Field Values
Constructor Detail

CostSensitiveClassifierSplitEvaluator

public CostSensitiveClassifierSplitEvaluator()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this split evaluator

Overrides:
globalInfo in class ClassifierSplitEvaluator
Returns:
a description of the split evaluator suitable for displaying in the explorer/experimenter gui

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options..

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class ClassifierSplitEvaluator
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options. Valid options (in addition to those of ClassifierSplitEvaluator) are:

-D directory
Name of a directory to search for cost files when loading costs on demand (default current directory).

All option after -- will be passed to the classifier.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class ClassifierSplitEvaluator
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()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class ClassifierSplitEvaluator
Returns:
an array of strings suitable for passing to setOptions

onDemandDirectoryTipText

public java.lang.String onDemandDirectoryTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getOnDemandDirectory

public java.io.File getOnDemandDirectory()
Returns the directory that will be searched for cost files when loading on demand.

Returns:
The cost file search directory.

setOnDemandDirectory

public void setOnDemandDirectory(java.io.File newDir)
Sets the directory that will be searched for cost files when loading on demand.

Parameters:
newDir - The cost file search directory.

getResultTypes

public java.lang.Object[] getResultTypes()
Gets the data types of each of the result columns produced for a single run. The number of result fields must be constant for a given SplitEvaluator.

Specified by:
getResultTypes in interface SplitEvaluator
Overrides:
getResultTypes in class ClassifierSplitEvaluator
Returns:
an array containing objects of the type of each result column. The objects should be Strings, or Doubles.

getResultNames

public java.lang.String[] getResultNames()
Gets the names of each of the result columns produced for a single run. The number of result fields must be constant for a given SplitEvaluator.

Specified by:
getResultNames in interface SplitEvaluator
Overrides:
getResultNames in class ClassifierSplitEvaluator
Returns:
an array containing the name of each result column

getResult

public java.lang.Object[] getResult(Instances train,
                                    Instances test)
                             throws java.lang.Exception
Gets the results for the supplied train and test datasets.

Specified by:
getResult in interface SplitEvaluator
Overrides:
getResult in class ClassifierSplitEvaluator
Parameters:
train - the training Instances.
test - the testing Instances.
Returns:
the results stored in an array. The objects stored in the array may be Strings, Doubles, or null (for the missing value).
Throws:
java.lang.Exception - if a problem occurs while getting the results

toString

public java.lang.String toString()
Returns a text description of the split evaluator.

Overrides:
toString in class ClassifierSplitEvaluator
Returns:
a text description of the split evaluator.