public class DiagonalGaussianModel extends java.lang.Object implements EMClusterModel<EMModel>
Modifier and Type | Field and Description |
---|---|
(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[] |
priordiag
For the MAP version only, a prior diagonal
|
private static double |
SINGULARITY_CHEAT
Constant to avoid singular matrixes.
|
(package private) double[] |
variances
Per-dimension variances.
|
(package private) double |
weight
Weight aggregation sum
|
(package private) double |
wsum
Weight aggregation sum
|
Constructor and Description |
---|
DiagonalGaussianModel(double weight,
double[] mean)
Constructor.
|
DiagonalGaussianModel(double weight,
double[] mean,
double[] variances)
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.
|
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.
|
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 final double SINGULARITY_CHEAT
double[] mean
double[] variances
double[] nmea
double logNorm
double logNormDet
double weight
double wsum
double[] priordiag
public DiagonalGaussianModel(double weight, double[] mean)
weight
- Cluster weightmean
- Initial meanpublic DiagonalGaussianModel(double weight, double[] mean, double[] variances)
weight
- Cluster weightmean
- Initial meanvariances
- Initial variances.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)public 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.