Package jline.lang.processes
Class GMM
java.lang.Object
jline.lang.processes.Distribution
jline.lang.processes.ContinuousDistribution
jline.lang.processes.GMM
- All Implemented Interfaces:
Serializable,Copyable
A Gaussian Mixture Model (GMM) distribution.
This class represents a mixture of normal distributions, where each component
has a weight, mean, and standard deviation.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionGMM(double[] weights, double[] means, double[] sigmas) Creates a GMM with specified components. -
Method Summary
Modifier and TypeMethodDescriptionautoMerge(int k) Automatically merges components to reduce the GMM to k components.Creates a new GMM by convolving this GMM with another GMM.doubleevalCDF(double x) Evaluates the cumulative distribution function (CDF) at the given point.doubleevalLST(double s) Evaluate the Laplace-Stieltjes Transform at sdoubleevalPDF(double x) static GMMfromMatrix(Matrix sgmm) Creates a GMM from a simplified matrix representation.doublegetMean()Gets the mean (expected value) of this distribution.double[]getMeans()intGets the process representation with actual distribution parameters.doublegetSCV()Gets the squared coefficient of variation (SCV) of this distribution.double[]doubleGets the skewness of this distribution.doublegetVar()Gets the variance of this distribution.double[]merge(int i, int j) Merges two components into one using moment matching.static GMMCreates a mixture of two GMMs with specified weights.double[]sample(int n) Generates random samples from this distribution using default random generator.double[]Generates random samples from this distribution using the specified random generator.toMatrix()Converts this GMM to a simplified matrix representation.toString()Methods inherited from class jline.lang.processes.Distribution
evalLST, evalProbInterval, getFeatureName, getName, getNumParams, getNumParams, getParam, getParam, getParams, getRate, getSupport, hasParam, isContinuous, isDisabled, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, scv, setNumParams, setParam, skewness, support, var
-
Constructor Details
-
GMM
public GMM(double[] weights, double[] means, double[] sigmas) Creates a GMM with specified components.- Parameters:
weights- array of component weights (must sum to 1)means- array of component meanssigmas- array of component standard deviations
-
-
Method Details
-
fromMatrix
Creates a GMM from a simplified matrix representation. Each row contains [weight, mean, sigma]. -
toMatrix
Converts this GMM to a simplified matrix representation. Each row contains [weight, mean, variance]. -
getMean
public double getMean()Description copied from class:DistributionGets the mean (expected value) of this distribution.- Specified by:
getMeanin classDistribution- Returns:
- the mean value
-
getVar
public double getVar()Description copied from class:DistributionGets the variance of this distribution. Computed as SCV * mean^2.- Overrides:
getVarin classDistribution- Returns:
- the variance
-
getSCV
public double getSCV()Description copied from class:DistributionGets the squared coefficient of variation (SCV) of this distribution. SCV = Var(X) / E[X]^2.- Specified by:
getSCVin classDistribution- Returns:
- the squared coefficient of variation
-
getSkewness
public double getSkewness()Description copied from class:DistributionGets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.- Specified by:
getSkewnessin classDistribution- Returns:
- the skewness value
-
evalCDF
public double evalCDF(double x) Description copied from class:DistributionEvaluates the cumulative distribution function (CDF) at the given point.- Specified by:
evalCDFin classDistribution- Parameters:
x- the point at which to evaluate the CDF- Returns:
- the CDF value at point t
-
evalPDF
public double evalPDF(double x) -
evalLST
public double evalLST(double s) Description copied from class:DistributionEvaluate the Laplace-Stieltjes Transform at s- Specified by:
evalLSTin classContinuousDistribution- Parameters:
s- the Laplace domain variable- Returns:
- the LST value at s
-
sample
public double[] sample(int n) Description copied from class:DistributionGenerates random samples from this distribution using default random generator.- Overrides:
samplein classDistribution- Parameters:
n- the number of samples to generate- Returns:
- array of random samples
-
sample
Description copied from class:DistributionGenerates random samples from this distribution using the specified random generator.- Specified by:
samplein classDistribution- Parameters:
n- the number of samples to generaterandom- the random number generator to use- Returns:
- array of random samples
-
convolve
Creates a new GMM by convolving this GMM with another GMM. Convolution corresponds to the sum of two independent random variables. -
mixture
Creates a mixture of two GMMs with specified weights. -
merge
Merges two components into one using moment matching. -
autoMerge
Automatically merges components to reduce the GMM to k components. -
getNumberOfComponents
public int getNumberOfComponents() -
getWeights
public double[] getWeights() -
getMeans
public double[] getMeans() -
getSigmas
public double[] getSigmas() -
getProcess
Description copied from class:ContinuousDistributionGets the process representation with actual distribution parameters. Returns a MatrixCell containing the distribution parameters.- Specified by:
getProcessin classContinuousDistribution- Returns:
- MatrixCell with distribution-specific parameters
-
toString
-