|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.math.linearalgebra.CovarianceMatrix
public class CovarianceMatrix
Class for computing covariance matrixes using stable mean and variance
computations.
This class encapsulates the mathematical aspects of computing this matrix.
See DatabaseUtil
for
easier to use APIs.
For use in algorithms, it is more appropriate to use
StandardCovarianceMatrixBuilder
since this class can be overriden with a stabilized covariance matrix builder!
Field Summary | |
---|---|
(package private) double[][] |
elements
The covariance matrix |
(package private) double[] |
mean
The means |
(package private) double[] |
nmea
Temporary storage, to avoid reallocations |
protected double |
wsum
The current weight |
Constructor Summary | |
---|---|
CovarianceMatrix(int dim)
Constructor. |
Method Summary | ||
---|---|---|
Matrix |
destroyToNaiveMatrix()
Obtain the covariance matrix according to the population statistics: n degrees of freedom. |
|
Matrix |
destroyToSampleMatrix()
Obtain the covariance matrix according to the sample statistics: (n-1) degrees of freedom. |
|
Vector |
getMeanVector()
Get the mean as vector. |
|
|
getMeanVector(Relation<? extends F> relation)
Get the mean as vector. |
|
static CovarianceMatrix |
make(Matrix mat)
Static Constructor. |
|
static CovarianceMatrix |
make(Relation<? extends NumberVector<?,?>> relation)
Static Constructor from a full relation. |
|
static CovarianceMatrix |
make(Relation<? extends NumberVector<?,?>> relation,
Iterable<DBID> ids)
Static Constructor from a full relation. |
|
Matrix |
makeNaiveMatrix()
Obtain the covariance matrix according to the population statistics: n degrees of freedom. |
|
Matrix |
makeSampleMatrix()
Obtain the covariance matrix according to the sample statistics: (n-1) degrees of freedom. |
|
void |
put(double[] val)
Add a single value with weight 1.0 |
|
void |
put(double[] val,
double weight)
Add data with a given weight. |
|
void |
put(NumberVector<?,?> val)
Add a single value with weight 1.0 |
|
void |
put(NumberVector<?,?> val,
double weight)
Add data with a given weight. |
|
void |
put(Vector val)
Add a single value with weight 1.0 |
|
void |
put(Vector val,
double weight)
Add data with a given weight. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
double[] mean
double[][] elements
double[] nmea
protected double wsum
Constructor Detail |
---|
public CovarianceMatrix(int dim)
dim
- DimensionalityMethod Detail |
---|
public void put(double[] val)
val
- Valuepublic void put(double[] val, double weight)
val
- dataweight
- weightpublic final void put(Vector val)
val
- Valuepublic final void put(Vector val, double weight)
val
- dataweight
- weightpublic void put(NumberVector<?,?> val)
val
- Valuepublic void put(NumberVector<?,?> val, double weight)
val
- dataweight
- weightpublic Vector getMeanVector()
public <F extends NumberVector<? extends F,?>> F getMeanVector(Relation<? extends F> relation)
public Matrix makeSampleMatrix()
destroyToSampleMatrix()
if you do not need further
updates.
public Matrix makeNaiveMatrix()
destroyToNaiveMatrix()
if you do not need further
updates.
public Matrix destroyToSampleMatrix()
makeSampleMatrix()
if
you want to perform further updates.
public Matrix destroyToNaiveMatrix()
makeNaiveMatrix()
if
you want to perform further updates.
public static CovarianceMatrix make(Matrix mat)
mat
- Matrix to use the columns ofpublic static CovarianceMatrix make(Relation<? extends NumberVector<?,?>> relation)
relation
- Relation to use.public static CovarianceMatrix make(Relation<? extends NumberVector<?,?>> relation, Iterable<DBID> ids)
relation
- Relation to use.ids
- IDs to add
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |