MissMecha
MissMecha is a Python package for the systematic simulation, visualization, and evaluation of missing data mechanisms.
It provides a unified, principled interface to generate, inspect, and analyze missingness — supporting research, benchmarking, and education.
Documentation: https://echoid.github.io/MissMecha/
Highlights
-
All About Missing Mechanisms
- Simulate MCAR, MAR, and MNAR with flexible configuration
- Currently supports:
3×MCAR strategies8×MAR strategies6×MNAR strategies- Experimental support for categorical and time series missingness
-
Missingness Pattern Visualization
- Visual tools to inspect missing patterns and detect possible mechanism types (MCAR, MAR, MNAR)
-
Flexible Generator Interface
- Column-wise or global simulation
- Scikit-learn style API (
fit,transform) - Customize missing rates, dependencies, or simulate label-dependent missingness
-
Evaluation Toolkit
- Evaluate imputation with RMSE, MAE, accuracy, or hybrid AvgERR metric
- Built-in statistical test: Little’s MCAR test
-
SimpleSmartImputer
- Lightweight, automatic imputer that detects column types
- Mean for numerical columns, Mode for categorical columns, with verbose reporting
-
Custom Mechanism Support (New in v0.1.2)
- Now supports user-defined missing mechanisms via
custom_class - Easily plug in your own masker with
fit+transforminterface - See Custom Mechanism Demo
- Now supports user-defined missing mechanisms via
-
Improved MNAR Type 1 (New in v0.1.2)
- Supports missing_rate-based quantile masking for fine control
- E.g. mask top 30% values in continuous columns via
missing_rate=0.3 - Fixes limitations when types vary across columns
- Thanks @mahshidkhatiri for raising the issue
Motivation
Working with missing data often means dealing with fragmented, inconsistent tools.
MissMecha solves this by offering a unified, reproducible, and flexible framework for simulating and analyzing missingness — covering the full range of MCAR, MAR, and MNAR patterns.
Whether you're exploring datasets, designing controlled experiments, or teaching statistics —
MissMecha brings structure and clarity to missing data problems.
Quick Preview
from missmecha import MissMechaGenerator
import numpy as np
X = np.random.rand(100, 5)
generator = MissMechaGenerator(
mechanism="mar", mechanism_type=1, missing_rate=0.3
)
X_missing = generator.fit_transform(X)
Or configure different mechanisms for each column:
generator = MissMechaGenerator(
info={
0: {"mechanism": "mcar", "type": 1, "rate": 0.3},
1: {"mechanism": "mnar", "type": 2, "rate": 0.4}
}
)
X_missing = generator.fit_transform(X)
Watch a 5-minute live demo here: MissMecha: Flexible Missing Data Simulation (Vimeo)
Documentation & Demos
- Explore full API and tutorials: https://echoid.github.io/MissMecha/
Installation
pip install missmecha-py
Available on PyPI under the package name missmecha-py.
Author
Developed by Youran Zhou, PhD Candidate @ Deakin University
License
MIT License
Metadata
Release files for missmecha-py 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| missmecha_py-0.1.2.tar.gz | 32.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| missmecha_py-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 69.7 kB
Release files / missmecha_py-0.1.2.tar.gz
| Download URL | missmecha_py-0.1.2.tar.gz |
|---|---|
| Size | 32.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f8d86df376db5f2a7372bd6aca3c4d8d9e7f20c24ab41a4d8c22c925b0dddf0
|
|
BLAKE2b-256 checksum How to use checksums |
729ca22cb205549d57d013e8d68040470e27f9c6a3903d12d0d14824d792e90f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Release files / missmecha_py-0.1.2-py3-none-any.whl
| Download URL | missmecha_py-0.1.2-py3-none-any.whl |
|---|---|
| Size | 37.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f85e0db591584ed0c647b268eba5c14bb5d686a636833f9bbeab269958ebdf95
|
|
BLAKE2b-256 checksum How to use checksums |
aa5989da414ea0e4df01b8b2356d522c7ef8c45ad0f64817572758174f4cb712
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|