weka.classifiers.meta
Class Grading

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.MultipleClassifiersCombiner
          extended byweka.classifiers.RandomizableMultipleClassifiersCombiner
              extended byweka.classifiers.meta.Stacking
                  extended byweka.classifiers.meta.Grading
All Implemented Interfaces:
java.lang.Cloneable, OptionHandler, Randomizable, java.io.Serializable

public class Grading
extends Stacking

Implements Grading. For more information, see

Seewald A.K., Fuernkranz J. (2001): An Evaluation of Grading Classifiers, in Hoffmann F.\ et al.\ (eds.), Advances in Intelligent Data Analysis, 4th International Conference, IDA 2001, Proceedings, Springer, Berlin/Heidelberg/New York/Tokyo, pp.115-124, 2001 Valid options are:

-X num_folds
The number of folds for the cross-validation (default 10).

-S seed
Random number seed (default 1).

-B classifierstring
Classifierstring should contain the full class name of a base scheme followed by options to the classifier. (required, option should be used once for each classifier).

-M classifierstring
Classifierstring for the meta classifier. Same format as for base classifiers. This classifier estimates confidence in prediction of base classifiers. (required)

Version:
$Revision: 1.4 $
Author:
Alexander K. Seewald (alex@seewald.at), Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
protected  double[] m_InstPerClass
          InstPerClass
protected  Classifier[] m_MetaClassifiers
          The meta classifiers, one for each base classifier.
 
Fields inherited from class weka.classifiers.meta.Stacking
m_BaseFormat, m_MetaClassifier, m_MetaFormat, m_NumFolds
 
Fields inherited from class weka.classifiers.RandomizableMultipleClassifiersCombiner
m_Seed
 
Fields inherited from class weka.classifiers.MultipleClassifiersCombiner
m_Classifiers
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Constructor Summary
Grading()
           
 
Method Summary
 double[] distributionForInstance(Instance instance)
          Returns class probabilities for a given instance using the stacked classifier.
protected  void generateMetaLevel(Instances newData, java.util.Random random)
          Generates the meta data
 java.lang.String globalInfo()
          Returns a string describing classifier
static void main(java.lang.String[] argv)
          Main method for testing this class.
protected  Instances metaFormat(Instances instances)
          Makes the format for the level-1 data.
protected  Instance metaInstance(Instance instance, int k)
          Makes a level-1 instance from the given instance.
 java.lang.String toString()
          Output a representation of this classifier
 
Methods inherited from class weka.classifiers.meta.Stacking
buildClassifier, getMetaClassifier, getNumFolds, getOptions, listOptions, metaClassifierTipText, metaInstance, metaOption, numFoldsTipText, processMetaOptions, setMetaClassifier, setNumFolds, setOptions
 
Methods inherited from class weka.classifiers.RandomizableMultipleClassifiersCombiner
getSeed, seedTipText, setSeed
 
Methods inherited from class weka.classifiers.MultipleClassifiersCombiner
classifiersTipText, getClassifier, getClassifiers, getClassifierSpec, setClassifiers
 
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_MetaClassifiers

protected Classifier[] m_MetaClassifiers
The meta classifiers, one for each base classifier.


m_InstPerClass

protected double[] m_InstPerClass
InstPerClass

Constructor Detail

Grading

public Grading()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing classifier

Overrides:
globalInfo in class Stacking
Returns:
a description suitable for displaying in the explorer/experimenter gui

generateMetaLevel

protected void generateMetaLevel(Instances newData,
                                 java.util.Random random)
                          throws java.lang.Exception
Generates the meta data

Overrides:
generateMetaLevel in class Stacking
Throws:
java.lang.Exception

distributionForInstance

public double[] distributionForInstance(Instance instance)
                                 throws java.lang.Exception
Returns class probabilities for a given instance using the stacked classifier. One class will always get all the probability mass (i.e. probability one).

Overrides:
distributionForInstance in class Stacking
Parameters:
instance - the instance to be classified
Throws:
java.lang.Exception - if instance could not be classified successfully

toString

public java.lang.String toString()
Output a representation of this classifier

Overrides:
toString in class Stacking

metaFormat

protected Instances metaFormat(Instances instances)
                        throws java.lang.Exception
Makes the format for the level-1 data.

Overrides:
metaFormat in class Stacking
Parameters:
instances - the level-0 format
Returns:
the format for the meta data
Throws:
java.lang.Exception

metaInstance

protected Instance metaInstance(Instance instance,
                                int k)
                         throws java.lang.Exception
Makes a level-1 instance from the given instance.

Parameters:
instance - the instance to be transformed
Returns:
the level-1 instance
Throws:
java.lang.Exception

main

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

Parameters:
argv - should contain the following arguments: -t training file [-T test file] [-c class index]