Dynamic Expectation-Maximization algorithms for Mixed-type Data
Project description
Dynamic Expectation-Maximization algorithms for Mixed-type Data
This repository provides tools and algorithms for the estimation of mixture models for mixed-type data. The algorithms jointly estimate the model parameters and the number of classes in the model.
This repository corresponds to the implementation of the paper 📄 Solange Pruilh, Stéphanie Allassonnière. Dynamic Expectation-Maximization algorithms for Mixed-type Data. 2024..
Requirements
The code was tested on Python 3.12.4.
With uv (recommended — installs Python and all dependencies in one step):
pip install uv # install uv once, globally
uv sync # creates .venv/ and installs all dependencies
uv run python # run any command inside the environment
With conda (alternative):
conda create -n DEM_MD --file requirements.txt
conda activate DEM_MD
pip install -e .
Quick start
import numpy as np
from dem_md import GaussianDEMMD
# Continuous-only data
X = np.random.randn(200, 4)
model = GaussianDEMMD()
labels = model.fit_predict(X)
# Mixed data (continuous + one Bernoulli discrete feature)
X_mixed = np.hstack([np.random.randn(200, 3), np.random.randint(0, 2, (200, 1))])
model_mixed = GaussianDEMMD(
type_discrete_features=["Bernoulli"],
index_discrete_features=[np.array([3])],
)
labels_mixed = model_mixed.fit_predict(X_mixed)
See the tutorial notebook for detailed experiments on different use cases.
Code
Several classes are provided, corresponding to DEM-MD algorithms to estimate different mixture models.
DEM_MD_gaussian.py,DEM_MD_student.pyandDEM_MD_sal.pycontain classes to estimate mixture models with respectively Gaussian (GaussianDEMMD), Student (StudentDEMMD) and Shifted Asymmetric Laplace (SALDEMMD) distributions.- These three DEM-MD classes are based on
base_DEM_MD.py,base_MD.pyandbase.pywhich are parent classes. utilsfolder contains several files with tool functions:sampling.pyfor sampling datasets,calculation.pyfor miscellaneous computations, andvalidation.pyfor input validation.history.pycontains theHistoricclass, which is directly instantiated into DEM-MD classes.Notations.mddocuments the variable naming conventions used throughout the codebase.
Citation
@unpublished{pruilh2024demmd,
title = {Dynamic Expectation-Maximization algorithms for Mixed-type Data},
author = {Pruilh, Solange and Allassonni{\`e}re, St{\'e}phanie},
year = {2024},
note = {Preprint},
url = {https://hal.science/hal-04510689},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dem_md-0.1.0.tar.gz.
File metadata
- Download URL: dem_md-0.1.0.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27115a934fb7b80b4fbf701977c5245a5d508721af00316b1840e9228bd0e112
|
|
| MD5 |
77ed06edd2c187fe4529056139bc365c
|
|
| BLAKE2b-256 |
21bb7a4fd3cac4507602a8f89bb2a739573eae2af906c028383c79e693cf7f65
|
File details
Details for the file dem_md-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dem_md-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
382b987a900f3ec2e555493da77ac8250d7952ade621398feae9f0d6ad190c47
|
|
| MD5 |
6dac7ab971f9d135f788b94bd353a59a
|
|
| BLAKE2b-256 |
e44e980dca5eb8e04a3946bef1b007ee0407e544878c0c99068b77e62dbeae73
|