edu.udo.cs.yale.operator.learner.meta
Class ContingencyMatrix

java.lang.Object
  extended by edu.udo.cs.yale.operator.learner.meta.ContingencyMatrix

public class ContingencyMatrix
extends java.lang.Object

This class computes the contingency matrix of classifiers, supports weighted example sets and contains some convenience methods to query for some evaluation metrics that can directly be computed from this matrix.

Version:
$Id: ContingencyMatrix.java,v 1.4 2006/04/14 15:04:22 ingomierswa Exp $
Author:
Martin Scholz

Field Summary
private  double[] colSums
           
private  double[][] matrix
           
private  double[] rowSums
           
private  double total
           
 
Constructor Summary
ContingencyMatrix(double[][] contigencyMatrix)
          The contigency matrix in the format [true label][predicted label]
 
Method Summary
 ContingencyMatrix clone()
           
 double getAccuracy()
           
 double getCoverage(int predictedLabel)
           
 double getErrorRate()
           
 double getLift(int trueLabel, int predictedLabel)
           
 double getLiftRatio(int trueLabel, int predictedLabel)
           
 double[] getLiftRatiosForPrediction(int predictedLabel)
           
 double[][] getMatrix()
           
 int getNumberOfClasses()
           
 int getNumberOfPredictions()
           
 double getPrecision(int trueLabel, int predictedLabel)
           
 double getPrior(int trueLabel)
           
 double[] getPriors()
           
 double getProbability(int trueLabel, int predictedLabel)
           
 double getTotalWeight()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrix

private final double[][] matrix

rowSums

private final double[] rowSums

colSums

private final double[] colSums

total

private final double total
Constructor Detail

ContingencyMatrix

public ContingencyMatrix(double[][] contigencyMatrix)
The contigency matrix in the format [true label][predicted label]

Parameters:
contigencyMatrix -

Method Detail

getMatrix

public double[][] getMatrix()

getNumberOfClasses

public int getNumberOfClasses()

getNumberOfPredictions

public int getNumberOfPredictions()

getPriors

public double[] getPriors()

getPrior

public double getPrior(int trueLabel)

getCoverage

public double getCoverage(int predictedLabel)

getProbability

public double getProbability(int trueLabel,
                             int predictedLabel)

getPrecision

public double getPrecision(int trueLabel,
                           int predictedLabel)

getLift

public double getLift(int trueLabel,
                      int predictedLabel)

getLiftRatio

public double getLiftRatio(int trueLabel,
                           int predictedLabel)

getLiftRatiosForPrediction

public double[] getLiftRatiosForPrediction(int predictedLabel)

getAccuracy

public double getAccuracy()

getErrorRate

public double getErrorRate()

getTotalWeight

public double getTotalWeight()

clone

public ContingencyMatrix clone()
Overrides:
clone in class java.lang.Object


Copyright © 2001-2006