public class MultivariateGaussianModel extends java.lang.Object implements EMClusterModel<EMModel>
Modifier and Type | Field and Description |
---|---|
(package private) CholeskyDecomposition |
chol
Decomposition of covariance matrix.
|
(package private) double[][] |
covariance
Covariance matrix.
|
private static Logging |
LOG
Class logger.
|
(package private) double |
logNorm
Normalization factor.
|
(package private) double |
logNormDet
Normalization factor.
|
(package private) double[] |
mean
Mean vector.
|
(package private) double[] |
nmea
Temporary storage, to avoid reallocations.
|
(package private) double |
prior
MAP prior / MLE prior.
|
(package private) double[][] |
priormatrix
Matrix for prior conditioning.
|
private static double |
SINGULARITY_CHEAT
Constant to avoid singular matrixes.
|
(package private) double |
weight
Weight aggregation sum
|
(package private) double |
wsum
Weight aggregation sum
|
Constructor and Description |
---|
MultivariateGaussianModel(double weight,
double[] mean)
Constructor.
|
MultivariateGaussianModel(double weight,
double[] mean,
double[][] covariance)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
beginEStep()
Begin the E step.
|
double |
estimateLogDensity(NumberVector vec)
Estimate the log likelihood of a vector.
|
EMModel |
finalizeCluster()
Finalize a cluster model.
|
void |
finalizeEStep(double weight,
double prior)
Finalize the E step.
|
private double |
getHalfLogDeterminant(CholeskyDecomposition chol)
Get 0.5 * log(det) of a cholesky decomposition.
|
double |
getWeight()
Get the cluster weight.
|
double |
mahalanobisDistance(NumberVector vec)
Compute the Mahalanobis distance from the centroid for a given vector.
|
void |
setWeight(double weight)
Set the cluster weight.
|
private void |
updateCholesky()
Update the cholesky decomposition.
|
void |
updateE(NumberVector vec,
double wei)
Process one data point in the E step
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
finalizeFirstPassE, firstPassE, needsTwoPass
private static Logging LOG
private static final double SINGULARITY_CHEAT
double[] mean
double[][] covariance
CholeskyDecomposition chol
double[] nmea
double logNorm
double logNormDet
double weight
double wsum
double prior
double[][] priormatrix
public MultivariateGaussianModel(double weight, double[] mean)
weight
- Cluster weightmean
- Initial meanpublic MultivariateGaussianModel(double weight, double[] mean, double[][] covariance)
weight
- Cluster weightmean
- Initial meancovariance
- initial covariance matrix.public void beginEStep()
EMClusterModel
beginEStep
in interface EMClusterModel<EMModel>
public void updateE(NumberVector vec, double wei)
EMClusterModel
updateE
in interface EMClusterModel<EMModel>
vec
- Vector to processwei
- Weight of point ("responsibility" of the cluster)public void finalizeEStep(double weight, double prior)
EMClusterModel
finalizeEStep
in interface EMClusterModel<EMModel>
weight
- weight of the clusterprior
- MAP prior (0 for MLE)private void updateCholesky()
private double getHalfLogDeterminant(CholeskyDecomposition chol)
chol
- Cholesky Decompositionpublic double mahalanobisDistance(NumberVector vec)
vec
- Vectorpublic double estimateLogDensity(NumberVector vec)
EMClusterModel
estimateLogDensity
in interface EMClusterModel<EMModel>
vec
- Vectorpublic double getWeight()
EMClusterModel
getWeight
in interface EMClusterModel<EMModel>
public void setWeight(double weight)
EMClusterModel
setWeight
in interface EMClusterModel<EMModel>
weight
- Cluster weightpublic EMModel finalizeCluster()
EMClusterModel
finalizeCluster
in interface EMClusterModel<EMModel>
Copyright © 2019 ELKI Development Team. License information.