org.apache.mahout.math.matrix.doublealgo
Class Statistic

java.lang.Object
  extended by org.apache.mahout.math.matrix.doublealgo.Statistic

Deprecated. until unit tests are in place. Until this time, this class/interface is unsupported.

@Deprecated
public class Statistic
extends java.lang.Object


Nested Class Summary
static interface Statistic.VectorVectorFunction
          Deprecated. until unit tests are in place. Until this time, this class/interface is unsupported.
 
Field Summary
static Statistic.VectorVectorFunction BRAY_CURTIS
          Deprecated. Bray-Curtis distance function; Sum( abs(x[i]-y[i]) ) / Sum( x[i]+y[i] ).
static Statistic.VectorVectorFunction CANBERRA
          Deprecated. Canberra distance function; Sum( abs(x[i]-y[i]) / abs(x[i]+y[i]) ).
static Statistic.VectorVectorFunction EUCLID
          Deprecated. Euclidean distance function; Sqrt(Sum( (x[i]-y[i])^2 )).
static Statistic.VectorVectorFunction MANHATTAN
          Deprecated. Manhattan distance function; Sum( abs(x[i]-y[i]) ).
static Statistic.VectorVectorFunction MAXIMUM
          Deprecated. Maximum distance function; Max( abs(x[i]-y[i]) ).
 
Method Summary
static DoubleMatrix2D correlation(DoubleMatrix2D covariance)
          Deprecated. Modifies the given covariance matrix to be a correlation matrix (in-place).
static DoubleMatrix2D covariance(DoubleMatrix2D matrix)
          Deprecated. Constructs and returns the covariance matrix of the given matrix.
static DoubleMatrix2D distance(DoubleMatrix2D matrix, Statistic.VectorVectorFunction distanceFunction)
          Deprecated. Constructs and returns the distance matrix of the given matrix.
static DoubleMatrix1D viewSample(DoubleMatrix1D matrix, double fraction, RandomEngine randomGenerator)
          Deprecated. Constructs and returns a sampling view with a size of round(matrix.size() * fraction).
static DoubleMatrix2D viewSample(DoubleMatrix2D matrix, double rowFraction, double columnFraction, RandomEngine randomGenerator)
          Deprecated. Constructs and returns a sampling view with round(matrix.rows() * rowFraction) rows and round(matrix.columns() * columnFraction) columns.
static DoubleMatrix3D viewSample(DoubleMatrix3D matrix, double sliceFraction, double rowFraction, double columnFraction, RandomEngine randomGenerator)
          Deprecated. Constructs and returns a sampling view with round(matrix.slices() * sliceFraction) slices and round(matrix.rows() * rowFraction) rows and round(matrix.columns() * columnFraction) columns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EUCLID

public static final Statistic.VectorVectorFunction EUCLID
Deprecated. 
Euclidean distance function; Sqrt(Sum( (x[i]-y[i])^2 )).


BRAY_CURTIS

public static final Statistic.VectorVectorFunction BRAY_CURTIS
Deprecated. 
Bray-Curtis distance function; Sum( abs(x[i]-y[i]) ) / Sum( x[i]+y[i] ).


CANBERRA

public static final Statistic.VectorVectorFunction CANBERRA
Deprecated. 
Canberra distance function; Sum( abs(x[i]-y[i]) / abs(x[i]+y[i]) ).


MAXIMUM

public static final Statistic.VectorVectorFunction MAXIMUM
Deprecated. 
Maximum distance function; Max( abs(x[i]-y[i]) ).


MANHATTAN

public static final Statistic.VectorVectorFunction MANHATTAN
Deprecated. 
Manhattan distance function; Sum( abs(x[i]-y[i]) ).

Method Detail

correlation

public static DoubleMatrix2D correlation(DoubleMatrix2D covariance)
Deprecated. 
Modifies the given covariance matrix to be a correlation matrix (in-place). The correlation matrix is a square, symmetric matrix consisting of nothing but correlation coefficients. The rows and the columns represent the variables, the cells represent correlation coefficients. The diagonal cells (i.e. the correlation between a variable and itself) will equal 1, for the simple reason that the correlation coefficient of a variable with itself equals 1. The correlation of two column vectors x and y is given by corr(x,y) = cov(x,y) / (stdDev(x)*stdDev(y)) (Pearson's correlation coefficient). A correlation coefficient varies between -1 (for a perfect negative relationship) to +1 (for a perfect positive relationship). See the math definition and another def. Compares two column vectors at a time. Use dice views to compare two row vectors at a time.

Parameters:
covariance - a covariance matrix, as, for example, returned by method covariance(DoubleMatrix2D).
Returns:
the modified covariance, now correlation matrix (for convenience only).

covariance

public static DoubleMatrix2D covariance(DoubleMatrix2D matrix)
Deprecated. 
Constructs and returns the covariance matrix of the given matrix. The covariance matrix is a square, symmetric matrix consisting of nothing but covariance coefficients. The rows and the columns represent the variables, the cells represent covariance coefficients. The diagonal cells (i.e. the covariance between a variable and itself) will equal the variances. The covariance of two column vectors x and y is given by cov(x,y) = (1/n) * Sum((x[i]-mean(x)) * (y[i]-mean(y))). See the math definition. Compares two column vectors at a time. Use dice views to compare two row vectors at a time.

Parameters:
matrix - any matrix; a column holds the values of a given variable.
Returns:
the covariance matrix (n x n, n=matrix.columns).

distance

public static DoubleMatrix2D distance(DoubleMatrix2D matrix,
                                      Statistic.VectorVectorFunction distanceFunction)
Deprecated. 
Constructs and returns the distance matrix of the given matrix. The distance matrix is a square, symmetric matrix consisting of nothing but distance coefficients. The rows and the columns represent the variables, the cells represent distance coefficients. The diagonal cells (i.e. the distance between a variable and itself) will be zero. Compares two column vectors at a time. Use dice views to compare two row vectors at a time.

Parameters:
matrix - any matrix; a column holds the values of a given variable (vector).
distanceFunction - (EUCLID, CANBERRA, ..., or any user defined distance function operating on two vectors).
Returns:
the distance matrix (n x n, n=matrix.columns).

viewSample

public static DoubleMatrix1D viewSample(DoubleMatrix1D matrix,
                                        double fraction,
                                        RandomEngine randomGenerator)
Deprecated. 
Constructs and returns a sampling view with a size of round(matrix.size() * fraction). Samples "without replacement" from the uniform distribution.

Parameters:
matrix - any matrix.
fraction - the percentage of rows to be included in the view.
randomGenerator - a uniform random number generator; set this parameter to null to use a default generator seeded with the current time.
Returns:
the sampling view.
Throws:
java.lang.IllegalArgumentException - if ! (0 <= rowFraction <= 1 && 0 <= columnFraction <= 1).
See Also:
RandomSampler

viewSample

public static DoubleMatrix2D viewSample(DoubleMatrix2D matrix,
                                        double rowFraction,
                                        double columnFraction,
                                        RandomEngine randomGenerator)
Deprecated. 
Constructs and returns a sampling view with round(matrix.rows() * rowFraction) rows and round(matrix.columns() * columnFraction) columns. Samples "without replacement". Rows and columns are randomly chosen from the uniform distribution. Examples:
matrix
rowFraction=0.2
columnFraction=0.2
rowFraction=0.2
columnFraction=1.0
rowFraction=1.0
columnFraction=0.2
10 x 10 matrix
 1  2  3  4  5  6  7  8  9  10
11 12 13 14 15 16 17 18 19  20
21 22 23 24 25 26 27 28 29  30
31 32 33 34 35 36 37 38 39  40
41 42 43 44 45 46 47 48 49  50
51 52 53 54 55 56 57 58 59  60
61 62 63 64 65 66 67 68 69  70
71 72 73 74 75 76 77 78 79  80
81 82 83 84 85 86 87 88 89  90
91 92 93 94 95 96 97 98 99 100
2 x 2 matrix
43 50
53 60
2 x 10 matrix
41 42 43 44 45 46 47 48 49  50
91 92 93 94 95 96 97 98 99 100
10 x 2 matrix
 4  8
14 18
24 28
34 38
44 48
54 58
64 68
74 78
84 88
94 98

Parameters:
matrix - any matrix.
rowFraction - the percentage of rows to be included in the view.
columnFraction - the percentage of columns to be included in the view.
randomGenerator - a uniform random number generator; set this parameter to null to use a default generator seeded with the current time.
Returns:
the sampling view.
Throws:
java.lang.IllegalArgumentException - if ! (0 <= rowFraction <= 1 && 0 <= columnFraction <= 1).
See Also:
RandomSampler

viewSample

public static DoubleMatrix3D viewSample(DoubleMatrix3D matrix,
                                        double sliceFraction,
                                        double rowFraction,
                                        double columnFraction,
                                        RandomEngine randomGenerator)
Deprecated. 
Constructs and returns a sampling view with round(matrix.slices() * sliceFraction) slices and round(matrix.rows() * rowFraction) rows and round(matrix.columns() * columnFraction) columns. Samples "without replacement". Slices, rows and columns are randomly chosen from the uniform distribution.

Parameters:
matrix - any matrix.
sliceFraction - the percentage of slices to be included in the view.
rowFraction - the percentage of rows to be included in the view.
columnFraction - the percentage of columns to be included in the view.
randomGenerator - a uniform random number generator; set this parameter to null to use a default generator seeded with the current time.
Returns:
the sampling view.
Throws:
java.lang.IllegalArgumentException - if ! (0 <= sliceFraction <= 1 && 0 <= rowFraction <= 1 && 0 <= columnFraction <= 1).
See Also:
RandomSampler


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.