Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.classifier
Class ConfusionMatrix

    java.lang.Object
      de.jstacs.classifier.ConfusionMatrix

All Implemented Interfaces:
  Storable

    public class ConfusionMatrix

extends Object
implements Storable

This class holds the confusion matrix of a classifier.

Author:
  Jens Keilwagen

Constructor Summary
`ConfusionMatrix(int classes)` This constructor creates an instance with a given number of classes.
`ConfusionMatrix(StringBuffer representation)` This is the constructor for the interface `Storable`.

Method Summary
`void` | `add(int realClass, int predictedClass)` This method updates the confusion matrix.
`int[][]` | `getMatrix()` This method returns the confusion matrix as a 2D-`int`-array.
`double` | `getMisclassificationRate()` This method returns the misclassification rate.
`StringBuffer` | `toXML()` This method returns an XML-representation of an instance of the implementing class.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConfusionMatrix

    public ConfusionMatrix(int classes)

  This constructor creates an instance with a given number of classes.

  Parameters:
    `classes` - the number of classes

### ConfusionMatrix

    public ConfusionMatrix(StringBuffer representation)
                    throws NonParsableException

  This is the constructor for the interface `Storable`.

  Parameters:
    `representation` - the XML representation
  Throws:
    `NonParsableException` - if the representation could not be parsed

Method Detail

### add

    public void add(int realClass,
                    int predictedClass)

  This method updates the confusion matrix.

  Parameters:
    `realClass` - the real class index
    `predictedClass` - the predicted class index

### getMatrix

    public int[][] getMatrix()

  This method returns the confusion matrix as a 2D-`int`-array.

  Returns:
    the confusion matrix

### getMisclassificationRate

    public double getMisclassificationRate()

  This method returns the misclassification rate.

  Returns:
    the misclassifcation rate

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML-representation of an instance of the implementing class.

  Specified by:
    `toXML` in interface `Storable`
  Returns:
    the XML-representation

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD