Skip to content

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

StructuredGaussianMixtures.jl

codecov

Overview

Fit weighted single Gaussians and Gaussian mixtures with separate structure and method specifications. Observations are columns of a features × samples matrix. Fitted models support logpdf, sampling, marginalization and conditional predict.

using StructuredGaussianMixtures, Random
X = randn(MersenneTwister(1), 10, 500)
spec = MixtureSpec(LowRankDiagonal(2), 4)
method = EM(covariance_method=CovarianceEM(maxiter=20), n_init=3)
gmm = fit(spec, method, X; rng=MersenneTwister(2))
posterior = predict(gmm, [0.2, -0.1], [1, 2], [3, 4])

# A single Gaussian uses the covariance solver directly.
gaussian = fit(FullCovariance(), Exact(), X)

# Explicit initialized state for continuation; fit! never reinitializes.
state = workspace(spec, method, gmm)
fit!(state, method, X)
state.report
  • FullCovariance(), DiagonalCovariance(), and IsotropicCovariance() use Exact() covariance updates. Add tied=Tied(:covariance) to MixtureSpec for one shared covariance with separate component means.
  • LowRankDiagonal(r) uses CovarianceEM() without forming a dense covariance.
  • LatentCovariance(r) supports single-Gaussian CovarianceEM() fitting.
  • LatentCovariance(r) with Tied(:F,:D) supports joint EM(covariance_method=CovarianceEM()), learning shared loadings and residual noise, or PCAEM(latent_method=EM(...)) for a fixed PCA projection. Both return LatentMvNormal components with explicit shared F and component latent covariances.
  • All fitting paths accept weights=... and fresh fits accept rng=....
  • Native EM provides convergence reports, restarts and weighted updates. responsibilities(gmm, X) returns posterior membership probabilities; predict continues to mean conditional prediction.

Install with Pkg.add("StructuredGaussianMixtures"). See the fitting guide for the API, supported combinations, initialization and migration from the former EM/FactorEM/PCAEM interface.

Banded precision models use fit(BandedPrecision(2), Exact(), X) or fit(MixtureSpec(BandedPrecision(2), 3), EM(), X). Precision bandwidth follows the feature order. Scoring uses compact bands, and conditioning preserves them when all omitted variables are observed. See the banded precision guide for regularization semantics and dense marginalization fallbacks.

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages