Package smile.stat.distribution
Class Mixture
- java.lang.Object
-
- smile.stat.distribution.AbstractDistribution
-
- smile.stat.distribution.Mixture
-
- All Implemented Interfaces:
java.io.Serializable,Distribution
public class Mixture extends AbstractDistribution
A finite mixture model is a probabilistic model for density estimation using a mixture distribution. A mixture model can be regarded as a type of unsupervised learning or clustering.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.
- Author:
- Haifeng Li
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMixture.ComponentA component in the mixture distribution is defined by a distribution and its weight in the mixture.
-
Constructor Summary
Constructors Constructor Description Mixture(java.util.List<Mixture.Component> mixture)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublebic(double[] data)BIC score of the mixture for given data.doublecdf(double x)Cumulative distribution function.doubleentropy()Shannon entropy.java.util.List<Mixture.Component>getComponents()Returns the list of components in the mixture.doublelogp(double x)The density at x in log scale, which may prevents the underflow problem.doublemean()The mean of distribution.intnpara()The number of parameters of the distribution.doublep(double x)The probability density function for continuous distribution or probability mass function for discrete distribution at x.doublequantile(double p)The quantile, the probability to the left of quantile is p.doublerand()Generates a random number following this distribution.doublesd()The standard deviation of distribution.intsize()Returns the number of components in the mixture.java.lang.StringtoString()doublevar()The variance of distribution.-
Methods inherited from class smile.stat.distribution.AbstractDistribution
inverseTransformSampling, likelihood, logLikelihood, quantile, quantile, rejection
-
-
-
-
Constructor Detail
-
Mixture
public Mixture(java.util.List<Mixture.Component> mixture)
Constructor.- Parameters:
mixture- a list of distributions.
-
-
Method Detail
-
mean
public double mean()
Description copied from interface:DistributionThe mean of distribution.
-
var
public double var()
Description copied from interface:DistributionThe variance of distribution.
-
sd
public double sd()
Description copied from interface:DistributionThe standard deviation of distribution.
-
entropy
public double entropy()
Shannon entropy. Not supported.
-
p
public double p(double x)
Description copied from interface:DistributionThe probability density function for continuous distribution or probability mass function for discrete distribution at x.
-
logp
public double logp(double x)
Description copied from interface:DistributionThe density at x in log scale, which may prevents the underflow problem.
-
cdf
public double cdf(double x)
Description copied from interface:DistributionCumulative distribution function. That is the probability to the left of x.
-
rand
public double rand()
Description copied from interface:DistributionGenerates a random number following this distribution.
-
quantile
public double quantile(double p)
Description copied from interface:DistributionThe quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.
-
npara
public int npara()
Description copied from interface:DistributionThe number of parameters of the distribution.
-
size
public int size()
Returns the number of components in the mixture.
-
bic
public double bic(double[] data)
BIC score of the mixture for given data.
-
getComponents
public java.util.List<Mixture.Component> getComponents()
Returns the list of components in the mixture.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-