public class GaussianMixtureModelEM extends Object
Implementation was originally inspired by the SciPy's "gmm.py".
| Modifier and Type | Class and Description |
|---|---|
static class |
GaussianMixtureModelEM.CovarianceType
Different forms of covariance matrix supported by the
GaussianMixtureModelEM. |
protected static class |
GaussianMixtureModelEM.EMGMM |
static class |
GaussianMixtureModelEM.UpdateOptions
Options for controlling what gets updated during the initialisation
and/or iterations.
|
| Constructor and Description |
|---|
GaussianMixtureModelEM(int nComponents,
GaussianMixtureModelEM.CovarianceType ctype)
Construct with the given arguments.
|
GaussianMixtureModelEM(int nComponents,
GaussianMixtureModelEM.CovarianceType ctype,
double thresh,
double minCovar,
int nIters,
int nInit,
EnumSet<GaussianMixtureModelEM.UpdateOptions> iterOpts,
EnumSet<GaussianMixtureModelEM.UpdateOptions> initOpts)
Construct with the given arguments.
|
| Modifier and Type | Method and Description |
|---|---|
GaussianMixtureModelEM |
clone() |
MixtureOfGaussians |
estimate(double[][] X)
Estimate a new
MixtureOfGaussians from the given data. |
MixtureOfGaussians |
estimate(Jama.Matrix X)
Estimate a new
MixtureOfGaussians from the given data. |
boolean |
hasConverged()
Get's the convergence state of the algorithm.
|
protected void |
mstep(GaussianMixtureModelEM.EMGMM gmm,
double[][] X,
double[][] responsibilities) |
public GaussianMixtureModelEM(int nComponents, GaussianMixtureModelEM.CovarianceType ctype, double thresh, double minCovar, int nIters, int nInit, EnumSet<GaussianMixtureModelEM.UpdateOptions> iterOpts, EnumSet<GaussianMixtureModelEM.UpdateOptions> initOpts)
nComponents - the number of gaussian componentsctype - the form of the covariance matricesthresh - the threshold at which to stop iteratingminCovar - the minimum value allowed in the diagonal of the estimated
covariance matrices to prevent overfittingnIters - the maximum number of iterationsnInit - the number of runs of the algorithm to perform; the best
result will be kept.iterOpts - options controlling what is updated during iterationinitOpts - options controlling what is updated during initialisation.
Enabling the GaussianMixtureModelEM.UpdateOptions.Means option will cause
K-Means to be used to generate initial starting points for the
means.public GaussianMixtureModelEM(int nComponents, GaussianMixtureModelEM.CovarianceType ctype)
nComponents - the number of gaussian componentsctype - the form of the covariance matricespublic boolean hasConverged()
estimate(double[][]) has not been called, or if the last call to
estimate(double[][]) failed to reach convergence before running
out of iterations.estimate(double[][]) reached
convergence; false otherwisepublic MixtureOfGaussians estimate(Jama.Matrix X)
MixtureOfGaussians from the given data. Use
hasConverged() to check whether the EM algorithm reached
convergence in the estimation of the returned model.X - the data matrix.public MixtureOfGaussians estimate(double[][] X)
MixtureOfGaussians from the given data. Use
hasConverged() to check whether the EM algorithm reached
convergence in the estimation of the returned model.X - the data array.protected void mstep(GaussianMixtureModelEM.EMGMM gmm, double[][] X, double[][] responsibilities)
public GaussianMixtureModelEM clone()