net.sf.myra.datamining
Class ConfusionMatrix

java.lang.Object
  extended by net.sf.myra.datamining.ConfusionMatrix
All Implemented Interfaces:
java.lang.Cloneable

public final class ConfusionMatrix
extends java.lang.Object
implements java.lang.Cloneable

This class represents a confusion matrix implementation.

Version:
$Revision$ $Date:: $
Author:
Fernando Esteban Barril Otero

Field Summary
static int FN
          The false negative's index.
static int FP
          The false positive's index.
static int TN
          The true negative's index.
static int TP
          The true positive's index.
 
Constructor Summary
ConfusionMatrix()
          Default constructor.
ConfusionMatrix(double tp, double fp, double fn, double tn)
          Creates a new ConfusionMatrix instance.
 
Method Summary
 void add(ConfusionMatrix other)
          Adds the values from the specified confusion matrix.
 void add(int field, double value)
          Adds the value to the specified cell.
 ConfusionMatrix clone()
           
 double get(int field)
          Returns the value of the specified cell.
 double getAccuracy()
          Returns the accuracy value.
 double getPrecision()
          Returns the precision value.
 double getRecall()
          Returns the recall value.
 double getSensitivity()
          Returns the sensitivity value.
 double getSpecificity()
          Returns the specificity value.
 void increment(int field)
          Increments the specified cell in the matrix.
 void set(int field, double value)
          Sets the value of the specified cell.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TP

public static final int TP
The true positive's index.

See Also:
Constant Field Values

FP

public static final int FP
The false positive's index.

See Also:
Constant Field Values

TN

public static final int TN
The true negative's index.

See Also:
Constant Field Values

FN

public static final int FN
The false negative's index.

See Also:
Constant Field Values
Constructor Detail

ConfusionMatrix

public ConfusionMatrix()
Default constructor.


ConfusionMatrix

public ConfusionMatrix(double tp,
                       double fp,
                       double fn,
                       double tn)
Creates a new ConfusionMatrix instance.

Parameters:
tp - true positive initial value.
fp - false positive initial value.
fn - false negative initial value.
tn - true negative initial value.
Method Detail

add

public void add(ConfusionMatrix other)
Adds the values from the specified confusion matrix.

Parameters:
other - the confusion matrix the add.

add

public void add(int field,
                double value)
Adds the value to the specified cell.

Parameters:
field - the cell of the matrix.
value - the value to add.

increment

public void increment(int field)
Increments the specified cell in the matrix.

Parameters:
field - the cell to increment.

get

public double get(int field)
Returns the value of the specified cell.

Parameters:
field - the cell.
Returns:
the value of the specified cell.

set

public void set(int field,
                double value)
Sets the value of the specified cell.

Parameters:
field - the field to set.
value - the value to set.

getSensitivity

public double getSensitivity()
Returns the sensitivity value.

Returns:
the sensitivity value.

getSpecificity

public double getSpecificity()
Returns the specificity value.

Returns:
the specificity value.

getPrecision

public double getPrecision()
Returns the precision value.

Returns:
the precision value.

getRecall

public double getRecall()
Returns the recall value.

Returns:
the recall value.

getAccuracy

public double getAccuracy()
Returns the accuracy value.

Returns:
the accuracy value.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

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


Copyright © 2013. All Rights Reserved.