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 MathIllegalArgumentException
data
- Data to use in fitting procedureMathIllegalArgumentException
- if data has no rowsMathIllegalArgumentException
- if rows of data have different numbers
of columnsMathIllegalArgumentException
- if the number of columns in the data is
less than 2public void fit(MixtureMultivariateNormalDistribution initialMixture, int maxIterations, double threshold) throws MathIllegalArgumentException
initialMixture
- Model containing initial values of weights and
multivariate normalsmaxIterations
- Maximum iterations allowed for fitthreshold
- Convergence threshold computed as difference in
logLikelihoods between successive iterationsMathIllegalArgumentException
- if any component's covariance matrix is
singular during fittingMathIllegalArgumentException
- if numComponents is less than one
or threshold is less than Double.MIN_VALUEMathIllegalArgumentException
- if initialMixture mean vector and data
number of columns are not equalpublic void fit(MixtureMultivariateNormalDistribution initialMixture) throws MathIllegalArgumentException
initialMixture
- Model containing initial values of weights and
multivariate normalsMathIllegalArgumentException
- if any component's covariance matrix is
singular during fittingMathIllegalArgumentException
- if numComponents is less than one or
threshold is less than Double.MIN_VALUEpublic static MixtureMultivariateNormalDistribution estimate(double[][] data, int numComponents) throws MathIllegalArgumentException
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 mixtureMathIllegalArgumentException
- if numComponents
is greater
than the number of data rows.MathIllegalArgumentException
- if numComponents < 2
.MathIllegalArgumentException
- if data has less than 2 rowsMathIllegalArgumentException
- if rows of data have different numbers
of columnspublic double getLogLikelihood()
public MixtureMultivariateNormalDistribution getFittedModel()
null
if no fit has been performed yet.Copyright © 2016-2021 CS GROUP. All rights reserved.