{"id":23105,"library":"gmr","title":"Gaussian Mixture Regression (gmr)","description":"Gaussian Mixture Regression (GMR) for learning and inferring multivariate probability distributions from data. Version 2.0.3 supports Python >=3.7, NumPy 2 compatibility, and sklearn-compatible GaussianMixtureRegressor. Low release cadence (last release 2024-06-03).","status":"active","version":"2.0.3","language":"python","source_language":"en","source_url":"https://github.com/AlexanderFabisch/gmr","tags":["gaussian-mixture-regression","probability","gmm","sklearn-compatible"],"install":[{"cmd":"pip install gmr","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Core dependency for array operations","package":"numpy","optional":false},{"reason":"For GaussianMixtureRegressor and clustering utilities","package":"scikit-learn","optional":true},{"reason":"Optional for some examples","package":"scipy","optional":true}],"imports":[{"note":"Flat import structure; submodule not exposed directly.","wrong":"from gmr.gmm import GMM","symbol":"GMM","correct":"from gmr import GMM"},{"note":"MVN is also exported from top-level.","wrong":"from gmr.mvn import MVN","symbol":"MVN","correct":"from gmr import MVN"},{"note":"Brought to top-level in 1.6.","wrong":"from gmr.sklearn import GaussianMixtureRegressor","symbol":"GaussianMixtureRegressor","correct":"from gmr import GaussianMixtureRegressor"}],"quickstart":{"code":"import numpy as np\nfrom gmr import GMM, MVN\n\n# Create a simple GMM with 2 components random init\nrandom_state = np.random.RandomState(0)\ngmm = GMM(n_components=2, random_state=random_state)\nX = np.random.randn(100, 3)\ngmm.from_samples(X)\n\n# Condition on first dimension\nmvn_conditional = gmm.condition(np.array([0.5]), [0])\nprint(\"Conditional mean:\", mvn_conditional.mean)\n","lang":"python","description":"Basic usage: create GMM, fit data, condition on a slice."},"warnings":[{"fix":"Access `.mean` and `.covariance` attributes on the returned MVN.","message":"`GMM.condition` now returns an `MVN` object (not tuple of mean/covariance). Code assuming tuple will break.","severity":"breaking","affected_versions":">=1.6"},{"fix":"If you relied on original scaling, normalize outputs or use v1.6.1.","message":"Probability density scaling fixed in v2.0.0; marginal densities may differ from v1.x by factor that ensures integration to 1.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use `oracle_approximating_shrinkage=True` (default) or regularize via `GMM.priors`. See docstring.","message":"`GMM.from_samples` does not check if the data has sufficient rank; singular covariance matrices cause runtime errors unless using oracle approximating shrinkage (enabled by default).","severity":"gotcha","affected_versions":">=1.6"},{"fix":"Upgrade to Python >=3.7 and gmr >=2.0.0.","message":"Python 2.7 support ended silently; no compatibility guarantees for Python 2.","severity":"deprecated","affected_versions":"<2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install gmr>=1.6 (`pip install gmr==2.0.3`) and ensure no local file named gmr.py.","cause":"Incorrect import path (tried `from gmr import GMM` but installed old version <1.6 or import shadowed by file named gmr.py).","error":"AttributeError: module 'gmr' has no attribute 'GMM'"},{"fix":"Verify that condition indices are within range [0, n_features-1] and values length equals len(indices).","cause":"Condition indices or values vector length mismatch with data dimensions.","error":"ValueError: operands could not be broadcast together with shapes ..."},{"fix":"Increase `n_components`, add noise to data, or set `random_state` to a different seed.","cause":"Covariance matrix became singular due to duplicate data points or insufficient samples per component.","error":"LinAlgError: Singular matrix"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}