程序包 weka.core
类 ContingencyTables
java.lang.Object
weka.core.ContingencyTables
- 所有已实现的接口:
RevisionHandler
Class implementing some statistical routines for contingency tables.
- 版本:
- $Revision: 8923 $
- 作者:
- Eibe Frank (eibe@cs.waikato.ac.nz)
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明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).Returns the revision string.static double
log2MultipleHypergeometric
(double[][] matrix) Returns negative base 2 logarithm of multiple hypergeometric probability for a contingency table.static void
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.
-
构造器详细资料
-
ContingencyTables
public ContingencyTables()
-
-
方法详细资料
-
chiSquared
public static double chiSquared(double[][] matrix, boolean yates) Returns chi-squared probability for a given matrix.- 参数:
matrix
- the contigency tableyates
- is Yates' correction to be used?- 返回:
- the chi-squared probability
-
chiVal
public static double chiVal(double[][] matrix, boolean useYates) Computes chi-squared statistic for a contingency table.- 参数:
matrix
- the contigency tableuseYates
- is Yates' correction to be used?- 返回:
- the value of the chi-squared statistic
-
cochransCriterion
public static boolean cochransCriterion(double[][] matrix) Tests if Cochran's criterion is fullfilled for the given contingency table. Rows and columns with all zeros are not considered relevant.- 参数:
matrix
- the contigency table to be tested- 返回:
- true if contingency table is ok, false if not
-
CramersV
public static double CramersV(double[][] matrix) Computes Cramer's V for a contingency table.- 参数:
matrix
- the contingency table- 返回:
- Cramer's V
-
entropy
public static double entropy(double[] array) Computes the entropy of the given array.- 参数:
array
- the array- 返回:
- the entropy
-
entropyConditionedOnColumns
public static double entropyConditionedOnColumns(double[][] matrix) Computes conditional entropy of the rows given the columns.- 参数:
matrix
- the contingency table- 返回:
- the conditional entropy of the rows given the columns
-
entropyConditionedOnRows
public static double entropyConditionedOnRows(double[][] matrix) Computes conditional entropy of the columns given the rows.- 参数:
matrix
- the contingency table- 返回:
- the conditional entropy of the columns given the rows
-
entropyConditionedOnRows
public 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. Uses a Laplace prior. Does NOT normalize the entropy.- 参数:
train
- the train matrixtest
- the test matrixnumClasses
- the number of symbols for Laplace- 返回:
- the entropy
-
entropyOverRows
public static double entropyOverRows(double[][] matrix) Computes the rows' entropy for the given contingency table.- 参数:
matrix
- the contingency table- 返回:
- the rows' entropy
-
entropyOverColumns
public static double entropyOverColumns(double[][] matrix) Computes the columns' entropy for the given contingency table.- 参数:
matrix
- the contingency table- 返回:
- the columns' entropy
-
gainRatio
public static double gainRatio(double[][] matrix) Computes gain ratio for contingency table (split on rows). Returns Double.MAX_VALUE if the split entropy is 0.- 参数:
matrix
- the contingency table- 返回:
- the gain ratio
-
log2MultipleHypergeometric
public static double log2MultipleHypergeometric(double[][] matrix) Returns negative base 2 logarithm of multiple hypergeometric probability for a contingency table.- 参数:
matrix
- the contingency table- 返回:
- the log of the hypergeometric probability of the contingency table
-
reduceMatrix
public static double[][] reduceMatrix(double[][] matrix) Reduces a matrix by deleting all zero rows and columns.- 参数:
matrix
- the matrix to be reduced- 返回:
- the matrix with all zero rows and columns deleted
-
symmetricalUncertainty
public static double symmetricalUncertainty(double[][] matrix) Calculates the symmetrical uncertainty for base 2.- 参数:
matrix
- the contingency table- 返回:
- the calculated symmetrical uncertainty
-
tauVal
public static double tauVal(double[][] matrix) Computes Goodman and Kruskal's tau-value for a contingency table.- 参数:
matrix
- the contingency table- 返回:
- Goodman and Kruskal's tau-value
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 返回:
- the revision
-
main
Main method for testing this class.
-