public class MultivariateNormalMixtureExpectationMaximization extends Object
| Constructor and Description |
|---|
MultivariateNormalMixtureExpectationMaximization(double[][] data)
Creates an object to fit a multivariate normal mixture model to data.
|
| Modifier and Type | Method and Description |
|---|---|
static MixtureMultivariateNormalDistribution |
estimate(double[][] data,
int numComponents)
Helper method to create a multivariate normal mixture model which can be
used to initialize
fit(MixtureMultivariateNormalDistribution). |
void |
fit(MixtureMultivariateNormalDistribution initialMixture)
Fit a mixture model to the data supplied to the constructor.
|
void |
fit(MixtureMultivariateNormalDistribution initialMixture,
int maxIterations,
double threshold)
Fit a mixture model to the data supplied to the constructor.
|
MixtureMultivariateNormalDistribution |
getFittedModel()
Gets the fitted model.
|
double |
getLogLikelihood()
Gets the log likelihood of the data under the fitted model.
|
public MultivariateNormalMixtureExpectationMaximization(double[][] data) throws NotStrictlyPositiveException, DimensionMismatchException, NumberIsTooSmallException
data - Data to use in fitting procedureNotStrictlyPositiveException - if data has no rowsDimensionMismatchException - if rows of data have different numbers
of columnsNumberIsTooSmallException - if the number of columns in the data is
less than 2public void fit(MixtureMultivariateNormalDistribution initialMixture, int maxIterations, double threshold) throws SingularMatrixException, NotStrictlyPositiveException, DimensionMismatchException
initialMixture - Model containing initial values of weights and
multivariate normalsmaxIterations - Maximum iterations allowed for fitthreshold - Convergence threshold computed as difference in
logLikelihoods between successive iterationsSingularMatrixException - if any component's covariance matrix is
singular during fittingNotStrictlyPositiveException - if numComponents is less than one
or threshold is less than Double.MIN_VALUEDimensionMismatchException - if initialMixture mean vector and data
number of columns are not equalpublic void fit(MixtureMultivariateNormalDistribution initialMixture) throws SingularMatrixException, NotStrictlyPositiveException
initialMixture - Model containing initial values of weights and
multivariate normalsSingularMatrixException - if any component's covariance matrix is
singular during fittingNotStrictlyPositiveException - if numComponents is less than one or
threshold is less than Double.MIN_VALUEpublic static MixtureMultivariateNormalDistribution estimate(double[][] data, int numComponents) throws NotStrictlyPositiveException, DimensionMismatchException
fit(MixtureMultivariateNormalDistribution).
This method uses the data supplied to the constructor to try to determine
a good mixture model at which to start the fit, but it is not guaranteed
to supply a model which will find the optimal solution or even converge.data - Data to estimate distributionnumComponents - Number of components for estimated mixtureNumberIsTooLargeException - if numComponents is greater
than the number of data rows.NumberIsTooSmallException - if numComponents < 2.NotStrictlyPositiveException - if data has less than 2 rowsDimensionMismatchException - if rows of data have different numbers
of columnspublic double getLogLikelihood()
public MixtureMultivariateNormalDistribution getFittedModel()
null if no fit has been performed yet.Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.