Skip to main content

All about missing data mechanisms: simulation, analysis, and visualization

Project description

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 strategies
      • 8× MAR strategies
      • 6× 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 + transform interface
    • See Custom Mechanism Demo
  • 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


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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

missmecha_py-0.1.2.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

missmecha_py-0.1.2-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file missmecha_py-0.1.2.tar.gz.

File metadata

  • Download URL: missmecha_py-0.1.2.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for missmecha_py-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3f8d86df376db5f2a7372bd6aca3c4d8d9e7f20c24ab41a4d8c22c925b0dddf0
MD5 fa9c8486479283640ec83d8d9148a6c9
BLAKE2b-256 729ca22cb205549d57d013e8d68040470e27f9c6a3903d12d0d14824d792e90f

See more details on using hashes here.

File details

Details for the file missmecha_py-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: missmecha_py-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 37.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for missmecha_py-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f85e0db591584ed0c647b268eba5c14bb5d686a636833f9bbeab269958ebdf95
MD5 2db083d76193257fce360c1b8a2abeff
BLAKE2b-256 aa5989da414ea0e4df01b8b2356d522c7ef8c45ad0f64817572758174f4cb712

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page