mclustpy
mclustpy is a Python function for clustering data using the Mclust algorithm from the R package mclust. The function takes a 2D numpy array of data and returns a dictionary containing various output values computed by the Mclust algorithm.
Installation
mclustpy requires the following dependencies:
- numpy
- rpy2
To install mclustpy, you can use pip:
pip install mclustpy
Usage
from mclustpy import mclustpy
import numpy as np
data = np.random.rand(1000, 10)
data.shape
res = mclustpy(data, G=9, modelNames='EEE', random_seed=2020)
The mclustpy function takes the following parameters:
- data: a 2D numpy array of data to be clustered.
- G: an integer specifying the maximum number of mixture components to be considered (default is 9).
- modelNames: a string specifying the model types to be considered (default is 'EEE').
- random_seed: an integer specifying the random seed for reproducibility (default is 2020).
The function returns a dictionary containing the following output values:
- call: the function call used to run the Mclust algorithm.
- data: the input data as an R matrix.
- modelName: the model name(s) selected by the algorithm.
- n: the number of observations in the data.
- d: the number of variables in the data.
- G: the number of mixture components selected by the algorithm.
- BIC: the Bayesian Information Criterion (BIC) value for the selected model.
- loglik: the log-likelihood of the selected model.
- df: the number of degrees of freedom in the selected model.
- bic: the BIC value for each model considered.
- icl: the Integrated Completed Likelihood (ICL) value for each model considered.
- hypvol: the hypervolume of the cluster tree for each model considered.
- parameters: the estimated parameters for each component in the selected model.
- z: the posterior probabilities of assignment to each component for each observation.
- classification: the classification of each observation under the selected model.
- uncertainty: a measure of uncertainty in the classification of each observation.
For more info take a look at the original mclust page
License Notice:
This package, mclustpy, is licensed under the MIT License. However, it depends on the R package mclust, which is licensed under the GNU General Public License (GPL ≥2). Users must ensure compliance with the GPL license when using mclustpy.
Metadata
Release files for mclustpy 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mclustpy-0.0.3.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mclustpy-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / mclustpy-0.0.3.tar.gz
| Download URL | mclustpy-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
125c4960283e661c7109dadafc7f2afa95e60b30c8a82dcc2daea8bdeee7ffbc
|
|
BLAKE2b-256 checksum How to use checksums |
06771bf917cca799e2500e18e1cad81e3f199cd84003505c6cd9e945bd0e73be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.18
|
Release files / mclustpy-0.0.3-py3-none-any.whl
| Download URL | mclustpy-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b21093bb5731dad451f17caa91c2be910f6dfe6277b77dfd7a6a824deae4147
|
|
BLAKE2b-256 checksum How to use checksums |
f605fc64dd5fb417d3773e142178ae5d82ec11d47955d84044c05941540f4758
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.18
|