public class TwoPassMultivariateGaussianModel 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 |
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[] |
tmp
Temporary storage, to avoid reallocations.
|
(package private) double |
weight
Weight aggregation sum
|
(package private) double |
wsum
Weight aggregation sum
|
| Constructor and Description |
|---|
TwoPassMultivariateGaussianModel(double weight,
double[] mean)
Constructor.
|
TwoPassMultivariateGaussianModel(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.
|
void |
finalizeFirstPassE()
Finish computation of the mean.
|
void |
firstPassE(NumberVector vec,
double wei)
First pass: update the mean only.
|
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.
|
boolean |
needsTwoPass()
True, if the model needs two passes in the E step.
|
void |
setWeight(double weight)
Set the cluster weight.
|
private void |
updateCholesky()
Update the cholesky decomposition.
|
void |
updateE(NumberVector vec,
double wei)
Second pass: compute the covariance matrix.
|
private static Logging LOG
private static final double SINGULARITY_CHEAT
double[] mean
double[][] covariance
CholeskyDecomposition chol
double[] tmp
double logNorm
double logNormDet
double weight
double wsum
double prior
double[][] priormatrix
public TwoPassMultivariateGaussianModel(double weight,
double[] mean)
weight - Cluster weightmean - Initial meanpublic TwoPassMultivariateGaussianModel(double weight,
double[] mean,
double[][] covariance)
weight - Cluster weightmean - Initial meancovariance - initial covariance matrix.public void beginEStep()
EMClusterModelbeginEStep in interface EMClusterModel<EMModel>public boolean needsTwoPass()
EMClusterModelneedsTwoPass in interface EMClusterModel<EMModel>true when an initial pass is needed.public void firstPassE(NumberVector vec, double wei)
firstPassE in interface EMClusterModel<EMModel>vec - Vector to processwei - Weight of point ("responsibility" of the cluster)public void finalizeFirstPassE()
finalizeFirstPassE in interface EMClusterModel<EMModel>public void updateE(NumberVector vec, double wei)
updateE in interface EMClusterModel<EMModel>vec - Vector to processwei - Weight of point ("responsibility" of the cluster)public void finalizeEStep(double weight,
double prior)
EMClusterModelfinalizeEStep 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)
EMClusterModelestimateLogDensity in interface EMClusterModel<EMModel>vec - Vectorpublic double getWeight()
EMClusterModelgetWeight in interface EMClusterModel<EMModel>public void setWeight(double weight)
EMClusterModelsetWeight in interface EMClusterModel<EMModel>weight - Cluster weightpublic EMModel finalizeCluster()
EMClusterModelfinalizeCluster in interface EMClusterModel<EMModel>Copyright © 2019 ELKI Development Team. License information.