weka.classifiers.meta
Class OrdinalClassClassifier

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.meta.OrdinalClassClassifier
All Implemented Interfaces:
java.lang.Cloneable, OptionHandler, java.io.Serializable

public class OrdinalClassClassifier
extends Classifier
implements OptionHandler

Meta classifier for transforming an ordinal class problem to a series of binary class problems. For more information see:

Frank, E. and Hall, M. (in press). A simple approach to ordinal prediction. 12th European Conference on Machine Learning. Freiburg, Germany.

Valid options are:

-W classname
Specify the full class name of a learner as the basis for the ordinalclassclassifier (required).

Version:
$Revision 1.0 $
Author:
Mark Hall
See Also:
OptionHandler, Serialized Form

Field Summary
private  Attribute m_ClassAttribute
          Internal copy of the class attribute for output purposes
private  MakeIndicator[] m_ClassFilters
          The filters used to transform the class.
private  Classifier m_Classifier
          The class name of the base classifier.
private  Classifier[] m_Classifiers
          The classifiers.
private  ZeroR m_ZeroR
          ZeroR classifier for when all base classifier return zero probability.
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Constructor Summary
OrdinalClassClassifier()
           
 
Method Summary
 void buildClassifier(Instances insts)
          Builds the classifiers.
 java.lang.String classifierTipText()
           
 double[] distributionForInstance(Instance inst)
          Returns the distribution for an instance.
 Classifier getClassifier()
          Get the classifier used as the classifier
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 java.lang.String globalInfo()
          Returns a string describing this attribute evaluator
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class.
 void setClassifier(Classifier newClassifier)
          Set the base classifier.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Prints the classifiers.
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Classifiers

private Classifier[] m_Classifiers
The classifiers. (One for each class.)


m_ClassFilters

private MakeIndicator[] m_ClassFilters
The filters used to transform the class.


m_Classifier

private Classifier m_Classifier
The class name of the base classifier.


m_ClassAttribute

private Attribute m_ClassAttribute
Internal copy of the class attribute for output purposes


m_ZeroR

private ZeroR m_ZeroR
ZeroR classifier for when all base classifier return zero probability.

Constructor Detail

OrdinalClassClassifier

public OrdinalClassClassifier()
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

buildClassifier

public void buildClassifier(Instances insts)
                     throws java.lang.Exception
Builds the classifiers.

Specified by:
buildClassifier in class Classifier
Parameters:
insts - the training data.
Throws:
java.lang.Exception - if a classifier can't be built

distributionForInstance

public double[] distributionForInstance(Instance inst)
                                 throws java.lang.Exception
Returns the distribution for an instance.

Overrides:
distributionForInstance in class Classifier
Parameters:
inst - the instance to be classified
Returns:
an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
Throws:
java.lang.Exception - if the distribution can't be computed successfully

listOptions

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

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class Classifier
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 are:

-W classname
Specify the full class name of a learner as the basis for the ordinalclassclassifier (required).

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
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 Classifier
Returns:
an array of strings suitable for passing to setOptions

classifierTipText

public java.lang.String classifierTipText()
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setClassifier

public void setClassifier(Classifier newClassifier)
Set the base classifier.

Parameters:
newClassifier - the Classifier to use.

getClassifier

public Classifier getClassifier()
Get the classifier used as the classifier

Returns:
the classifier used as the classifier

toString

public java.lang.String toString()
Prints the classifiers.


main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - the options