org.strbio.math
Class CorrectMatrix

java.lang.Object
  extended by org.strbio.math.IMatrix
      extended by org.strbio.math.StatsMatrix
          extended by org.strbio.math.CorrectMatrix

public class CorrectMatrix
extends StatsMatrix

If your prediction is yes/no, or if you are only interested in stats on correctness and incorrectness, you can create a matrix which is 2xN, where N is the number of possible categories in reality, and data[0][i] indicates the number of wrong predictions of things belonging to catogory i (you predicted them as something other than i), while data[1][i] indicates the number of correct predictions of things belonging to category i.

Version:
1.0
Author:
JMC

Field Summary
 
Fields inherited from class org.strbio.math.IMatrix
data
 
Constructor Summary
CorrectMatrix()
           
CorrectMatrix(IMatrix x)
           
CorrectMatrix(int n)
           
CorrectMatrix(int[][] x)
           
 
Method Summary
 void addCorrect(int a)
          Add a correct guess for category A.
 void addWrong(int a)
          Add a wrong guess for category A.
 double matthews(int a)
          Return the Matthews correlation coefficient for property A.
 double pctRight()
          return percent right, from 0 to 100.
 double pctRightActually(int a)
          Return the percent right only for predictions of items which actually belonged to category A.
 int rightActually(int a)
          How many of the items that actually belonged to category A were predicted correctly?
 int totalActually(int a)
          How many items are there in category A?
 int wrongActually(int a)
          How many of the items that actually belonged to category A were predicted incorrectly?
 
Methods inherited from class org.strbio.math.StatsMatrix
clear
 
Methods inherited from class org.strbio.math.IMatrix
add, add, cols, equals, isEmpty, load, load, load, max, min, multiply, multiply, multiply, print, rows, save, save, saveBinary, saveBinary, setValue, setValueAt, subtract, subtract, valueAt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorrectMatrix

public CorrectMatrix()

CorrectMatrix

public CorrectMatrix(int n)

CorrectMatrix

public CorrectMatrix(IMatrix x)

CorrectMatrix

public CorrectMatrix(int[][] x)
Method Detail

pctRight

public final double pctRight()
return percent right, from 0 to 100.

Specified by:
pctRight in class StatsMatrix

matthews

public final double matthews(int a)
Return the Matthews correlation coefficient for property A.

Specified by:
matthews in class StatsMatrix

pctRightActually

public final double pctRightActually(int a)
Return the percent right only for predictions of items which actually belonged to category A.

Specified by:
pctRightActually in class StatsMatrix

rightActually

public final int rightActually(int a)
How many of the items that actually belonged to category A were predicted correctly?

Specified by:
rightActually in class StatsMatrix

wrongActually

public final int wrongActually(int a)
How many of the items that actually belonged to category A were predicted incorrectly?

Specified by:
wrongActually in class StatsMatrix

totalActually

public final int totalActually(int a)
How many items are there in category A?

Specified by:
totalActually in class StatsMatrix

addCorrect

public final void addCorrect(int a)
Add a correct guess for category A.


addWrong

public final void addWrong(int a)
Add a wrong guess for category A.