public class ConfusionMatrix extends Matrix
| Constructor and Description |
|---|
ConfusionMatrix(String[] classNames)
Creates the confusion matrix with the given class names.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPrediction(NominalPrediction pred)
Includes a prediction in the confusion matrix.
|
void |
addPredictions(ArrayList<Prediction> predictions)
Includes a whole bunch of predictions in the confusion matrix.
|
String |
className(int index)
Gets the name of one of the classes.
|
Object |
clone()
Creates and returns a clone of this object.
|
double |
correct()
Gets the number of correct classifications (that is, for which a correct
prediction was made).
|
double |
errorRate()
Returns the estimated error rate.
|
String |
getRevision()
Returns the revision string.
|
TwoClassStats |
getTwoClassStats(int classIndex)
Gets the performance with respect to one of the classes as a TwoClassStats
object.
|
double |
incorrect()
Gets the number of incorrect classifications (that is, for which an
incorrect prediction was made).
|
ConfusionMatrix |
makeWeighted(CostMatrix costs)
Makes a copy of this ConfusionMatrix after applying the supplied CostMatrix
to the cells.
|
int |
size()
Gets the number of classes.
|
String |
toString()
Calls toString() with a default title.
|
String |
toString(String title)
Outputs the performance statistics as a classification confusion matrix.
|
double |
total()
Gets the number of predictions that were made (actually the sum of the
weights of predictions where the class value was known).
|
arrayLeftDivide, arrayLeftDivideEquals, arrayRightDivide, arrayRightDivideEquals, arrayTimes, arrayTimesEquals, chol, cond, constructWithCopy, copy, det, eig, get, getArray, getArrayCopy, getColumnDimension, getColumnPackedCopy, getMatrix, getMatrix, getMatrix, getMatrix, getRowDimension, getRowPackedCopy, identity, inverse, isSquare, isSymmetric, lu, main, minus, minusEquals, norm1, norm2, normF, normInf, parseMatlab, plus, plusEquals, print, print, print, print, qr, random, rank, read, regression, regression, set, setMatrix, setMatrix, setMatrix, setMatrix, solve, solveTranspose, sqrt, svd, times, times, timesEquals, toMatlab, trace, transpose, uminus, writepublic ConfusionMatrix(String[] classNames)
classNames - an array containing the names the classes.public ConfusionMatrix makeWeighted(CostMatrix costs) throws Exception
costs - the CostMatrix.Exception - if the CostMatrix is not of the same size as this
ConfusionMatrix.public Object clone()
public int size()
public String className(int index)
index - the index of the class.public void addPrediction(NominalPrediction pred) throws Exception
pred - the NominalPrediction to includeException - if no valid prediction was made (i.e. unclassified).public void addPredictions(ArrayList<Prediction> predictions) throws Exception
predictions - a FastVector containing the NominalPredictions to
includeException - if no valid prediction was made (i.e. unclassified).public TwoClassStats getTwoClassStats(int classIndex)
classIndex - the index of the class of interest.public double correct()
public double incorrect()
public double total()
public double errorRate()
public String toString()
public String toString(String title)
title - the title for the confusion matrixpublic String getRevision()
getRevision in interface RevisionHandlergetRevision in class MatrixCopyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.