public class Statistic extends Object
cern.jet.stat
and hep.aida.bin
, in particular hep.aida.bin.DynamicBin1D
.
Examples:
A | covariance(A) | correlation(covariance(A)) | distance(A,EUCLID) |
4 x 3 matrix 1 2 3 2 4 6 3 6 9 4 -8 -10 |
3 x 3 matrix 1.25 -3.5 -4.5 -3.5 29 39 -4.5 39 52.5 |
3 x 3 matrix 1 -0.581318 -0.555492 -0.581318 1 0.999507 -0.555492 0.999507 1 |
3 x 3 matrix 0 12.569805 15.874508 12.569805 0 4.242641 15.874508 4.242641 0 |
Modifier and Type | Class and Description |
---|---|
static interface |
Statistic.VectorVectorFunction
Interface that represents a function object: a function that takes
two argument vectors and returns a single value.
|
Modifier and Type | Field and Description |
---|---|
static Statistic.VectorVectorFunction |
BRAY_CURTIS
Bray-Curtis distance function; Sum( abs(x[i]-y[i]) ) / Sum( x[i]+y[i] ).
|
static Statistic.VectorVectorFunction |
CANBERRA
Canberra distance function; Sum( abs(x[i]-y[i]) / abs(x[i]+y[i]) ).
|
static Statistic.VectorVectorFunction |
EUCLID
Euclidean distance function; Sqrt(Sum( (x[i]-y[i])^2 )).
|
static Statistic.VectorVectorFunction |
MANHATTAN
Manhattan distance function; Sum( abs(x[i]-y[i]) ).
|
static Statistic.VectorVectorFunction |
MAXIMUM
Maximum distance function; Max( abs(x[i]-y[i]) ).
|
Modifier | Constructor and Description |
---|---|
protected |
Statistic()
Makes this class non instantiable, but still let's others inherit from it.
|
Modifier and Type | Method and Description |
---|---|
static DoubleMatrix2D |
correlation(DoubleMatrix2D covariance)
Modifies the given covariance matrix to be a correlation matrix (in-place).
|
static DoubleMatrix2D |
covariance(DoubleMatrix2D matrix)
Constructs and returns the covariance matrix of the given matrix.
|
static void |
demo1()
Demonstrates usage of this class.
|
static void |
demo2(int rows,
int columns,
boolean print)
Demonstrates usage of this class.
|
static void |
demo3(Statistic.VectorVectorFunction norm)
Demonstrates usage of this class.
|
static DoubleMatrix2D |
distance(DoubleMatrix2D matrix,
Statistic.VectorVectorFunction distanceFunction)
Constructs and returns the distance matrix of the given matrix.
|
static void |
main(String[] args)
Benchmarks covariance computation.
|
static DoubleMatrix1D |
viewSample(DoubleMatrix1D matrix,
double fraction,
RandomEngine randomGenerator)
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)
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)
Constructs and returns a sampling view with round(matrix.slices() * sliceFraction) slices and round(matrix.rows() * rowFraction) rows and round(matrix.columns() * columnFraction) columns.
|
public static final Statistic.VectorVectorFunction EUCLID
public static final Statistic.VectorVectorFunction BRAY_CURTIS
public static final Statistic.VectorVectorFunction CANBERRA
public static final Statistic.VectorVectorFunction MAXIMUM
public static final Statistic.VectorVectorFunction MANHATTAN
protected Statistic()
public static DoubleMatrix2D correlation(DoubleMatrix2D covariance)
covariance
- a covariance matrix, as, for example, returned by method covariance(DoubleMatrix2D)
.public static DoubleMatrix2D covariance(DoubleMatrix2D matrix)
matrix
- any matrix; a column holds the values of a given variable.public static void demo1()
public static void demo2(int rows, int columns, boolean print)
public static void demo3(Statistic.VectorVectorFunction norm)
public static DoubleMatrix2D distance(DoubleMatrix2D matrix, Statistic.VectorVectorFunction distanceFunction)
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).public static void main(String[] args)
public static DoubleMatrix1D viewSample(DoubleMatrix1D matrix, double fraction, RandomEngine randomGenerator)
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.IllegalArgumentException
- if ! (0 <= rowFraction <= 1 && 0 <= columnFraction <= 1).RandomSampler
public static DoubleMatrix2D viewSample(DoubleMatrix2D matrix, double rowFraction, double columnFraction, RandomEngine randomGenerator)
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 |
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.IllegalArgumentException
- if ! (0 <= rowFraction <= 1 && 0 <= columnFraction <= 1).RandomSampler
public static DoubleMatrix3D viewSample(DoubleMatrix3D matrix, double sliceFraction, double rowFraction, double columnFraction, RandomEngine randomGenerator)
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.IllegalArgumentException
- if ! (0 <= sliceFraction <= 1 && 0 <= rowFraction <= 1 && 0 <= columnFraction <= 1).RandomSampler
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.