Skip to main content

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, GMModel. Estimate a model from your data, read its parameters, then classify points or draw new samples.

import numpy as np
from gmcluster import GMModel

X = np.random.default_rng(0).standard_normal((500, 2))

# Estimate the mixture; "auto" selects the number of clusters by MDL.
gm = GMModel.estimate(X, num_clusters="auto")

print(gm.num_components)   # number of clusters found
print(gm.weights)          # shape (K,)
print(gm.means)            # shape (K, M)
print(gm.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 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.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gmcluster 0.4.0
File Size Uploaded Provenance Actions
gmcluster-0.4.0.tar.gz 14.1 kB With provenance Details for gmcluster-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gmcluster 0.4.0
File Interpreter ABI Platform Actions
gmcluster-0.4.0-py3-none-any.whl Python 3 none any Details for gmcluster-0.4.0-py3-none-any.whl

Total release size: 24.9 kB

Release files / gmcluster-0.4.0.tar.gz

Download URL gmcluster-0.4.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b8c6cacadd547436f84bd28e40a9149212e4ce2731ef3385ae340e6e74d02b1b
BLAKE2b-256 checksum
How to use checksums
438c5009a82a97ac45d8770c86ff88bc67e6921d7de79a54e48aa5e72cf6eb87
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

Release files / gmcluster-0.4.0-py3-none-any.whl

Download URL gmcluster-0.4.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60f62fec8ecb8b811b0cccf22105aad0763b1231bd31fe5f075be52a7cf4b356
BLAKE2b-256 checksum
How to use checksums
3232eefe95d6a0ad6ec49a04bbe02a3f0556111e4090d96a54f8ea6e6403a151
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

Security for gmcluster 0.4.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gmcluster-0.4.0.tar.gz

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

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page