Class MultivariateMixture

java.lang.Object
smile.stat.distribution.MultivariateMixture
All Implemented Interfaces:
Serializable, MultivariateDistribution
Direct Known Subclasses:
MultivariateExponentialFamilyMixture

public class MultivariateMixture extends Object implements MultivariateDistribution
The finite mixture of multivariate distributions.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    A component in the mixture distribution is defined by a distribution and its weight in the mixture.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The components of finite mixture model.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    bic(double[][] data)
    Returns the BIC score.
    double
    cdf(double[] x)
    Cumulative distribution function.
    cov()
    The covariance matrix of distribution.
    double
    Shannon entropy.
    int
    The number of parameters of the distribution.
    double
    logp(double[] x)
    The density at x in log scale, which may prevents the underflow problem.
    int
    map(double[] x)
    Returns the index of component with maximum a posteriori probability.
    double[]
    The mean vector of distribution.
    double
    p(double[] x)
    The probability density function for continuous distribution or probability mass function for discrete distribution at x.
    double[]
    posteriori(double[] x)
    Returns the posteriori probabilities.
    int
    Returns the number of components in the mixture.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface smile.stat.distribution.MultivariateDistribution

    likelihood, logLikelihood
  • Field Details

  • Constructor Details

    • MultivariateMixture

      public MultivariateMixture(MultivariateMixture.Component... components)
      Constructor.
      Parameters:
      components - a list of multivariate distributions.
  • Method Details

    • posteriori

      public double[] posteriori(double[] x)
      Returns the posteriori probabilities.
      Parameters:
      x - a real vector.
      Returns:
      the posteriori probabilities.
    • map

      public int map(double[] x)
      Returns the index of component with maximum a posteriori probability.
      Parameters:
      x - a real vector.
      Returns:
      the index of component with maximum a posteriori probability.
    • mean

      public double[] mean()
      Description copied from interface: MultivariateDistribution
      The mean vector of distribution.
      Specified by:
      mean in interface MultivariateDistribution
      Returns:
      the mean vector.
    • cov

      public Matrix cov()
      Description copied from interface: MultivariateDistribution
      The covariance matrix of distribution.
      Specified by:
      cov in interface MultivariateDistribution
      Returns:
      the covariance matrix.
    • entropy

      public double entropy()
      Shannon entropy. Not supported.
      Specified by:
      entropy in interface MultivariateDistribution
      Returns:
      Shannon entropy
    • p

      public double p(double[] x)
      Description copied from interface: MultivariateDistribution
      The probability density function for continuous distribution or probability mass function for discrete distribution at x.
      Specified by:
      p in interface MultivariateDistribution
      Parameters:
      x - a real vector.
      Returns:
      the desnity.
    • logp

      public double logp(double[] x)
      Description copied from interface: MultivariateDistribution
      The density at x in log scale, which may prevents the underflow problem.
      Specified by:
      logp in interface MultivariateDistribution
      Parameters:
      x - a real vector.
      Returns:
      the log density.
    • cdf

      public double cdf(double[] x)
      Description copied from interface: MultivariateDistribution
      Cumulative distribution function. That is the probability to the left of x.
      Specified by:
      cdf in interface MultivariateDistribution
      Parameters:
      x - a real vector.
      Returns:
      the probability.
    • length

      public int length()
      Description copied from interface: MultivariateDistribution
      The number of parameters of the distribution. The "length" is in the sense of the minimum description length principle.
      Specified by:
      length in interface MultivariateDistribution
      Returns:
      the number of parameters of the distribution.
    • size

      public int size()
      Returns the number of components in the mixture.
      Returns:
      the number of components.
    • bic

      public double bic(double[][] data)
      Returns the BIC score.
      Parameters:
      data - the data to calculate likelihood.
      Returns:
      the BIC score.
    • toString

      public String toString()
      Overrides:
      toString in class Object