## org.apache.mahout.classifier
Class ConfusionMatrix

    java.lang.Object
      org.apache.mahout.classifier.ConfusionMatrix

All Implemented Interfaces:
  Summarizable

    public class ConfusionMatrix

extends java.lang.Object
implements Summarizable

The ConfusionMatrix Class stores the result of Classification of a Test Dataset. See http://en.wikipedia.org/wiki/Confusion_matrix for background

Constructor Summary
`ConfusionMatrix(java.util.Collection<java.lang.String> labels, java.lang.String defaultLabel)`

Method Summary
`void` `addInstance(java.lang.String correctLabel, ClassifierResult classifiedResult)`
`void` `addInstance(java.lang.String correctLabel, java.lang.String classifiedLabel)`
`double` `getAccuracy(java.lang.String label)`
`int[][]` `getConfusionMatrix()`
`int` `getCorrect(java.lang.String label)`
`int` `getCount(java.lang.String correctLabel, java.lang.String classifiedLabel)`
`java.util.Collection<java.lang.String>` `getLabels()`
`double` `getTotal(java.lang.String label)`
`void` `incrementCount(java.lang.String correctLabel, java.lang.String classifiedLabel)`
`void` `incrementCount(java.lang.String correctLabel, java.lang.String classifiedLabel, int count)`
`ConfusionMatrix` `merge(ConfusionMatrix b)`
`void` `putCount(java.lang.String correctLabel, java.lang.String classifiedLabel, int count)`
`java.lang.String` `summarize()`

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

Constructor Detail

### ConfusionMatrix

    public ConfusionMatrix(java.util.Collection<java.lang.String> labels,
                           java.lang.String defaultLabel)

Method Detail

### getConfusionMatrix

    public int[][] getConfusionMatrix()

### getLabels

    public java.util.Collection<java.lang.String> getLabels()

### getAccuracy

    public double getAccuracy(java.lang.String label)

### getCorrect

    public int getCorrect(java.lang.String label)

### getTotal

    public double getTotal(java.lang.String label)

### addInstance

    public void addInstance(java.lang.String correctLabel,
                            ClassifierResult classifiedResult)

### addInstance

    public void addInstance(java.lang.String correctLabel,
                            java.lang.String classifiedLabel)

### getCount

    public int getCount(java.lang.String correctLabel,
                        java.lang.String classifiedLabel)

### putCount

    public void putCount(java.lang.String correctLabel,
                         java.lang.String classifiedLabel,
                         int count)

### incrementCount

    public void incrementCount(java.lang.String correctLabel,
                               java.lang.String classifiedLabel,
                               int count)

### incrementCount

    public void incrementCount(java.lang.String correctLabel,
                               java.lang.String classifiedLabel)

### merge

    public ConfusionMatrix merge(ConfusionMatrix b)

### summarize

    public java.lang.String summarize()

  Specified by:
    `summarize` in interface `Summarizable`
  Returns:
    Summary of the data inside the class

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.