Class GMM

  • All Implemented Interfaces:
    java.io.Serializable , jline.lang.Copyable

    
    public class GMM
    extends ContinuousDistribution implements Serializable
                        

    A Gaussian Mixture Model (GMM) distribution. This class represents a mixture of normal distributions, where each component has a weight, mean, and standard deviation.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      GMM(Array<double> weights, Array<double> means, Array<double> sigmas) Creates a GMM with specified components.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Array<double> getWeights()
      Array<double> getMeans()
      Array<double> getSigmas()
      static GMM fromMatrix(Matrix sgmm) Creates a GMM from a simplified matrix representation.
      Matrix toMatrix() Converts this GMM to a simplified matrix representation.
      double getMean() Gets the mean (expected value) of this distribution.
      double getVar() Gets the variance of this distribution.
      double getSCV() Gets the squared coefficient of variation (SCV) of this distribution.
      double getSkewness() Gets the skewness of this distribution.
      double evalCDF(double x) Evaluates the cumulative distribution function (CDF) at the given point.
      double evalPDF(double x)
      double evalLST(double s) Evaluate the Laplace-Stieltjes Transform at s
      Array<double> sample(int n) Generates random samples from this distribution using default random generator.
      Array<double> sample(int n, Random random) Generates random samples from this distribution using the specified random generator.
      GMM convolve(GMM other) Creates a new GMM by convolving this GMM with another GMM.
      static GMM mixture(GMM gmm1, GMM gmm2, double p1, double p2) Creates a mixture of two GMMs with specified weights.
      GMM merge(int i, int j) Merges two components into one using moment matching.
      GMM autoMerge(int k) Automatically merges components to reduce the GMM to k components.
      int getNumberOfComponents()
      String toString()
      • Methods inherited from class jline.lang.processes.Distribution

        evalProbInterval, getName, getNumParams, getParam, getRate, getSupport, isContinuous, isDisabled, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, scv, setNumParams, setParam, skewness, support, var
      • Methods inherited from class jline.lang.Copyable

        copy
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GMM

        GMM(Array<double> weights, Array<double> means, Array<double> sigmas)
        Creates a GMM with specified components.
        Parameters:
        weights - array of component weights (must sum to 1)
        means - array of component means
        sigmas - array of component standard deviations
    • Method Detail

      • fromMatrix

         static GMM fromMatrix(Matrix sgmm)

        Creates a GMM from a simplified matrix representation. Each row contains [weight, mean, sigma].

      • toMatrix

         Matrix toMatrix()

        Converts this GMM to a simplified matrix representation. Each row contains [weight, mean, variance].

      • getMean

         double getMean()

        Gets the mean (expected value) of this distribution.

        Returns:

        the mean value

      • getVar

         double getVar()

        Gets the variance of this distribution. Computed as SCV * mean^2.

        Returns:

        the variance

      • getSCV

         double getSCV()

        Gets the squared coefficient of variation (SCV) of this distribution. SCV = Var(X) / E[X]^2.

        Returns:

        the squared coefficient of variation

      • getSkewness

         double getSkewness()

        Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.

        Returns:

        the skewness value

      • evalCDF

         double evalCDF(double x)

        Evaluates the cumulative distribution function (CDF) at the given point.

        Returns:

        the CDF value at point t

      • evalPDF

         double evalPDF(double x)
      • evalLST

         double evalLST(double s)

        Evaluate the Laplace-Stieltjes Transform at s

        Parameters:
        s - the Laplace domain variable
        Returns:

        the LST value at s

      • sample

         Array<double> sample(int n)

        Generates random samples from this distribution using default random generator.

        Parameters:
        n - the number of samples to generate
        Returns:

        array of random samples

      • sample

         Array<double> sample(int n, Random random)

        Generates random samples from this distribution using the specified random generator.

        Parameters:
        n - the number of samples to generate
        random - the random number generator to use
        Returns:

        array of random samples

      • convolve

         GMM convolve(GMM other)

        Creates a new GMM by convolving this GMM with another GMM. Convolution corresponds to the sum of two independent random variables.

      • mixture

         static GMM mixture(GMM gmm1, GMM gmm2, double p1, double p2)

        Creates a mixture of two GMMs with specified weights.

      • merge

         GMM merge(int i, int j)

        Merges two components into one using moment matching.

      • autoMerge

         GMM autoMerge(int k)

        Automatically merges components to reduce the GMM to k components.