public class DoubleGaussianMixtureModel extends java.lang.Object implements DensityFunction<double[]>
Gaussian Mixture Model for estimating the density on arrays of double.
The initialization of the Gaussian centers is performed by k-means, then the EM algorithm runs until the centers stabilize.
Constructor and Description |
---|
DoubleGaussianMixtureModel(int nb_gaussian) |
Modifier and Type | Method and Description |
---|---|
int |
getK()
Get the number of components in the mixture
|
double[][] |
getMu()
Gets the centers of each component of the mixture
|
double[][][] |
getSigma()
Gets the inverse covariance matrices of each component of the mixture
|
double[] |
getW()
Gets the weights associated with each component of the mixture
|
double[] |
likelihood(double[] e)
Return a vector containing the likelihood to each Gaussian component
|
void |
setK(int k)
Sets the number of components in the mixture
|
void |
setMu(double[][] mu)
Sets the centers of each component of the mixture
|
void |
setSigma(double[][][] sigma)
Sets the inverse covariance matrices of each component of the mixture
|
void |
setW(double[] w)
Sets the weights associated with each Component of the mixture
|
void |
train(double[] e)
Adds a sample to the training set and train the density function
|
void |
train(java.util.List<double[]> e)
Train the density function on the specified training set
|
double |
valueOf(double[] e)
Value of the density function for the specified sample
|
public void train(double[] e)
DensityFunction
train
in interface DensityFunction<double[]>
e
- the sample to add to the training setpublic void train(java.util.List<double[]> e)
DensityFunction
train
in interface DensityFunction<double[]>
e
- the list of training samplespublic double valueOf(double[] e)
DensityFunction
valueOf
in interface DensityFunction<double[]>
e
- the sample to evaluatepublic double[] likelihood(double[] e)
e
- the sample to evaluatepublic int getK()
public void setK(int k)
k
- the number of Gaussianpublic double[] getW()
public void setW(double[] w)
w
- an array containing the weights of each Gaussianpublic double[][] getMu()
public void setMu(double[][] mu)
mu
- an array of of double arrays, each being the center of the
coresponding Gaussianpublic double[][][] getSigma()
public void setSigma(double[][][] sigma)
sigma
- an array of double[][], each being the inverse covariance
matrix of associated Gaussian