public class Mixture extends AbstractDistribution
The Expectation-maximization algorithm can be used to compute the parameters of a parametric mixture model distribution. The EM algorithm is a method for finding maximum likelihood estimates of parameters, where the model depends on unobserved latent variables. EM is an iterative method which alternates between performing an expectation (E) step, which computes the expectation of the log-likelihood evaluated using the current estimate for the latent variables, and a maximization (M) step, which computes parameters maximizing the expected log-likelihood found on the E step. These parameter estimates are then used to determine the distribution of the latent variables in the next E step.
| Modifier and Type | Class and Description |
|---|---|
static class |
Mixture.Component
A component in the mixture distribution is defined by a distribution
and its weight in the mixture.
|
| Constructor and Description |
|---|
Mixture(java.util.List<Mixture.Component> mixture)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
bic(double[] data)
BIC score of the mixture for given data.
|
double |
cdf(double x)
Cumulative distribution function.
|
double |
entropy()
Shannon entropy.
|
java.util.List<Mixture.Component> |
getComponents()
Returns the list of components in the mixture.
|
double |
logp(double x)
The density at x in log scale, which may prevents the underflow problem.
|
double |
mean()
The mean of distribution.
|
int |
npara()
The number of parameters of the distribution.
|
double |
p(double x)
The probability density function for continuous distribution
or probability mass function for discrete distribution at x.
|
double |
quantile(double p)
The quantile, the probability to the left of quantile is p.
|
double |
rand()
Generates a random number following this distribution.
|
double |
sd()
The standard deviation of distribution.
|
int |
size()
Returns the number of components in the mixture.
|
java.lang.String |
toString() |
double |
var()
The variance of distribution.
|
inverseTransformSampling, likelihood, logLikelihood, quantile, quantile, rejectionpublic Mixture(java.util.List<Mixture.Component> mixture)
mixture - a list of distributions.public double mean()
Distributionpublic double var()
Distributionpublic double sd()
Distributionpublic double entropy()
public double p(double x)
Distributionpublic double logp(double x)
Distributionpublic double cdf(double x)
Distributionpublic double rand()
Distributionpublic double quantile(double p)
Distributionpublic int npara()
Distributionpublic int size()
public double bic(double[] data)
public java.util.List<Mixture.Component> getComponents()
public java.lang.String toString()
toString in class java.lang.Object