|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.ContingencyTables
Class implementing some statistical routines for contingency tables.
Field Summary | |
private static double |
log2
The natural logarithm of 2 |
Constructor Summary | |
ContingencyTables()
|
Method Summary | |
private static double |
chiCell(double freq,
double expected,
boolean yates)
Computes chi-value for one cell in a contingency table. |
static double |
chiSquared(double[][] matrix,
boolean yates)
Returns chi-squared probability for a given matrix. |
static double |
chiVal(double[][] matrix,
boolean useYates)
Computes chi-squared statistic for a contingency table. |
static boolean |
cochransCriterion(double[][] matrix)
Tests if Cochran's criterion is fullfilled for the given contingency table. |
static double |
CramersV(double[][] matrix)
Computes Cramer's V for a contingency table. |
static double |
entropy(double[] array)
Computes the entropy of the given array. |
static double |
entropyConditionedOnColumns(double[][] matrix)
Computes conditional entropy of the rows given the columns. |
static double |
entropyConditionedOnRows(double[][] matrix)
Computes conditional entropy of the columns given the rows. |
static double |
entropyConditionedOnRows(double[][] train,
double[][] test,
double numClasses)
Computes conditional entropy of the columns given the rows of the test matrix with respect to the train matrix. |
static double |
entropyOverColumns(double[][] matrix)
Computes the columns' entropy for the given contingency table. |
static double |
entropyOverRows(double[][] matrix)
Computes the rows' entropy for the given contingency table. |
static double |
gainRatio(double[][] matrix)
Computes gain ratio for contingency table (split on rows). |
private static double |
lnFunc(double num)
Help method for computing entropy. |
static double |
log2MultipleHypergeometric(double[][] matrix)
Returns negative base 2 logarithm of multiple hypergeometric probability for a contingency table. |
static void |
main(java.lang.String[] ops)
Main method for testing this class. |
static double[][] |
reduceMatrix(double[][] matrix)
Reduces a matrix by deleting all zero rows and columns. |
static double |
symmetricalUncertainty(double[][] matrix)
Calculates the symmetrical uncertainty for base 2. |
static double |
tauVal(double[][] matrix)
Computes Goodman and Kruskal's tau-value for a contingency table. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static double log2
Constructor Detail |
public ContingencyTables()
Method Detail |
public static double chiSquared(double[][] matrix, boolean yates)
matrix
- the contigency tableyates
- is Yates' correction to be used?
public static double chiVal(double[][] matrix, boolean useYates)
matrix
- the contigency table
public static boolean cochransCriterion(double[][] matrix)
matrix
- the contigency table to be tested
public static double CramersV(double[][] matrix)
matrix
- the contingency table
public static double entropy(double[] array)
array
- the array
public static double entropyConditionedOnColumns(double[][] matrix)
matrix
- the contingency table
public static double entropyConditionedOnRows(double[][] matrix)
matrix
- the contingency table
public static double entropyConditionedOnRows(double[][] train, double[][] test, double numClasses)
train
- the train matrixtest
- the test matrix
public static double entropyOverRows(double[][] matrix)
matrix
- the contingency table
public static double entropyOverColumns(double[][] matrix)
matrix
- the contingency table
public static double gainRatio(double[][] matrix)
matrix
- the contingency table
public static double log2MultipleHypergeometric(double[][] matrix)
matrix
- the contingency table
public static double[][] reduceMatrix(double[][] matrix)
matrix
- the matrix to be reducedpublic static double symmetricalUncertainty(double[][] matrix)
matrix
- the contingency table
public static double tauVal(double[][] matrix)
matrix
- the contingency tableprivate static double lnFunc(double num)
private static double chiCell(double freq, double expected, boolean yates)
freq
- the observed frequency in the cellexpected
- the expected frequency in the cell
public static void main(java.lang.String[] ops)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |