GMCluster
GMCluster fits a Gaussian mixture model to data by EM and selects the number of clusters automatically using the minimum description length (MDL) criterion.
It is a Python rewrite of the C package Cluster. Full documentation is at https://gmcluster.readthedocs.io/ .
Installing
Install the latest release from PyPI:
pip install gmcluster
To install from source (for development), clone the repository and do an editable install:
git clone https://github.com/cabouman/gmcluster.git cd gmcluster pip install -e .
Quick Start
The package provides one class, GaussianMixture. Fit it to your data, read the estimated parameters, then classify points or draw new samples.
import numpy as np
from gmcluster import GaussianMixture
X = np.random.default_rng(0).standard_normal((500, 2))
# Fit the mixture; "auto" selects the number of clusters by MDL.
gm = GaussianMixture(num_clusters="auto").fit(X)
print(gm.estimated_num_clusters) # number of clusters found
print(gm.estimated_weights) # shape (K,)
print(gm.estimated_means) # shape (K, M)
print(gm.estimated_covariances) # shape (K, M, M)
labels = gm.classify(X) # most-likely cluster per point, shape (N,)
new_points = gm.sample(100) # draw 100 samples from the fitted mixture
Running the demos
Validate the installation by running a demo:
cd demo python demo_1.py
Citation
Please cite this software when you use it. The BibTeX entry is in docs/source/credits.rst and in the online documentation at https://gmcluster.readthedocs.io/ .
Metadata
Release files for gmcluster 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gmcluster-0.3.0.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gmcluster-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / gmcluster-0.3.0.tar.gz
| Download URL | gmcluster-0.3.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d71e4e0ffea2bf06bc8cb41107036877dee43b763a590a55b0ffee8d5b1ab81
|
|
BLAKE2b-256 checksum How to use checksums |
254547f78a63f9f38e4286001b426d85c380b19e30281da994cf37b0ece5dd03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / gmcluster-0.3.0-py3-none-any.whl
| Download URL | gmcluster-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bba222867b0e4f59aaff0cb341b197dad87e7ede5e9ee2656a02a54f9cefb6d
|
|
BLAKE2b-256 checksum How to use checksums |
3bad99ef1afe1e4dc552d81151bfe3438dff166385fe88c8499bdf9667895cf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency log