Class 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 class  Mixture.Component
      A 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
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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: Distribution
        The mean of distribution.
      • var

        public double var()
        Description copied from interface: Distribution
        The variance of distribution.
      • sd

        public double sd()
        Description copied from interface: Distribution
        The standard deviation of distribution.
      • entropy

        public double entropy()
        Shannon entropy. Not supported.
      • p

        public double p​(double x)
        Description copied from interface: Distribution
        The 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: Distribution
        The density at x in log scale, which may prevents the underflow problem.
      • cdf

        public double cdf​(double x)
        Description copied from interface: Distribution
        Cumulative distribution function. That is the probability to the left of x.
      • rand

        public double rand()
        Description copied from interface: Distribution
        Generates a random number following this distribution.
      • quantile

        public double quantile​(double p)
        Description copied from interface: Distribution
        The 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: Distribution
        The 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:
        toString in class java.lang.Object