Skip to main content

MIMIC Tabular

Read the Docs DOI

MIMIC stands for Modular Inference for Missingness, Inconsistency, and Creation. It is a modular framework for working with mixed tabular data. It treats imputation, consistency checking, supervised prediction, uncertainty estimation, and synthetic data generation as variations of the same problem: predicting one feature from the rest of the row.

Start here

This README is the project overview and API tour. The onboarding guides provide step-by-step paths for using and developing MIMIC.

The project is designed around a scikit-learn-style estimator with replaceable encoders, decoders, and generation policies. The current implementation includes tree-based, neural, linear, stochastic, and identity-style components so the same interface can be used for practical modelling, diagnostics, and baselines.

What MIMIC Does

  • Fills missing values in numerical and categorical columns.
  • Estimates confidence and uncertainty for feature-wise predictions.
  • Treats labels as ordinary columns, allowing supervised prediction through the same imputation interface.
  • Generates synthetic tabular rows from learned representations or baseline feature-space policies.
  • Keeps generation traceable by exposing the steps used to create synthetic values.

Core Idea

For each modelled column, MIMIC learns how to predict that column from the other columns. These feature-wise models produce latent representations, predictions, and uncertainty diagnostics. Because every column is handled through the same abstraction, the framework can support missing-value repair, label prediction, outlier-style inconsistency checks, and synthetic generation without separate task-specific pipelines.

Quick Example

from mimic import mimic_data

synthetic = mimic_data(df, mode="factorised", capacity=0.25)

mimic_data(df, mode="factorised", capacity=0.25) fits a default MIMIC model internally and returns the same number of synthetic rows. It is the simplest interface when you only need a sampled dataframe.

The manuscript datasets can be loaded with matching MIMIC column roles in one call:

from mimic import load_paper_dataset, mimic_data

df, columns = load_paper_dataset("adult", n_rows=1000, random_state=0)
synthetic = mimic_data(df, columns=columns)

Available keys are adult, bank_marketing, and default_credit. The returned columns mapping contains ignore, regression, and classification lists and can be passed directly to MIMIC or mimic_data.

Nearest-neighbor ambiguity filtering is available as an opt-in attribution-risk reduction step. It rejects generated embeddings that are too easily associated with one training row or generation pair; it is not a formal differential privacy guarantee.

synthetic = mimic_data(df, privacy_filter=True)

Fitted models can be saved and loaded locally so generation can be repeated without retraining:

synthetic = mimic_data(df, save_model="adult_mimic.joblib")
more_synthetic = mimic_data(df, load_model="adult_mimic.joblib", n_samples=1000)

The estimator API exposes the same persistence path:

model = MIMIC(mode="factorised", random_state=0).fit(df)
model.save("adult_mimic.joblib")

loaded = MIMIC.load("adult_mimic.joblib")
synthetic = loaded.sample(1000)

The same one-shot workflow is available from the command line:

mimic-data data.csv

This writes data_mimic.csv beside the input file. CSV, Parquet, and Excel inputs are supported. Optional flags include --columns, --mode, --capacity, --save-model, and --load-model; run mimic-data --help for details.

Use the estimator directly when you want imputation, confidence diagnostics, traceability, or reusable fitted state:

from mimic import MIMIC

model = MIMIC(
    columns="auto",
    random_state=0,
)

model.fit(df)

imputed = model.impute(df)
confidence = model.confidence(df)
synthetic = model.sample(100)

Embeddings can also be stacked with IteratedMIMIC. The first MIMIC model fits the original row space, later models fit the previous level's embedding table, and inverse_transform decodes back through the stack. Later levels preserve each feature embedding as one vector block, so a higher level predicts a whole feature-embedding vector at once rather than one scalar dimension at a time:

from mimic import IteratedMIMIC

stack = IteratedMIMIC(n_steps=2, random_state=0).fit(df)
top_embedding = stack.transform(df)
reconstructed = stack.inverse_transform(top_embedding)

columns="auto" infers roles using simple heuristics: ID-like or near-unique columns are ignored, small integer-valued numeric columns are classification, other numeric columns are regression, and non-numeric columns are classification. For production use, pass an explicit role mapping such as columns={"ignore": [...], "regression": [...], "classification": [...]}.

Embedding plots use IMSTE by default for 2D layouts of the preprocessed input and MIMIC embedding. Classical MDS remains available with method="mds". Plots can focus on selected feature embeddings while colouring by raw dataframe values:

fig, axes = model.plot(df, embedding_columns=["age", "income"], color_by="segment")
# Keep the classical MDS layout when needed:
fig, axes = model.plot(df, method="mds", embedding_columns=["age", "income"])

Synthetic-data diagnostics include numeric pairwise plots and categorical distribution comparisons:

from mimic.diagnostics import categorical_feature_report, pairwise_feature_plot

pairwise_feature_plot(
    heldout,
    synthetic,
    features=["age", "hours-per-week", "capital-gain", "capital-loss"],
    log1p_features=["capital-gain", "capital-loss"],
)
category_report, category_summary = categorical_feature_report(
    heldout,
    synthetic,
    features=["workclass", "education", "income"],
)

MIMIC also provides simplified mode and capacity presets. The default mode="factorised", capacity=0.25 uses neural components, factorised probabilistic decoding, n_bootstrap=2, and a mutual-neighbour displacement generation policy:

GenerationPolicy(
    method="displacement",
    neighbour_mode="mutual",
    n_neighbors=5,
    lambda_range=(0.25, 0.75),
)

mode="identity" / mode=0

Uses the identity encoder and identity decoder. Generation operates directly in the preprocessed feature space, so this mode is useful as a transparent baseline for checking what MIMIC adds beyond SMOTE-style interpolation or displacement.

mode="direct" / mode=1

Uses the neural encoder preset and deterministic decoding. Synthetic embeddings are decoded directly into feature values without stochastic conditional resampling, making outputs easier to reproduce and traces simpler.

mode="factorised" / mode=2

Uses the neural encoder preset with probabilistic factorised decoding. After an initial deterministic decode, feature values are sampled from feature-wise conditional decoders given the rest of the embedding. This is the default mode because it keeps generation stochastic while preserving the modular feature-wise design.

Numerical columns can optionally share one feature-conditioned residual network. Each target receives a learned feature identity and optional coordinate descriptors, while FiLM layers condition the residual blocks. The target value is masked before encoding, so each returned feature block remains conditional on the rest of the row:

from mimic import MIMIC, SharedFeatureGroup, SharedResNetEncoder

pixels = SharedFeatureGroup(
    columns=pixel_columns,
    coordinates=pixel_coordinates,  # shape: (len(pixel_columns), coordinate_dim)
    encoder=SharedResNetEncoder(embedding_dim=32),
    target_chunk_size=64,
)
model = MIMIC(
    columns={"regression": pixel_columns, "classification": [], "ignore": []},
    shared_feature_groups={"pixels": pixels},
)

Shared groups currently support numerical regression columns. Ungrouped and categorical columns continue to use independent feature modules. Coordinates must be finite and supplied in the same order as columns; image helpers normalize spatial coordinates to [0, 1].

mode="joint" / mode=3

Uses the neural encoder preset with deterministic joint decoding. A shared neural row decoder predicts all modelled columns from concatenated conditional evidence. This mode must be requested explicitly and currently requires the neural conditional sampler.

capacity is a number from 0 to 1 that scales preset hyperparameters: embedding dimension, hidden dimension, layer count, epochs, patience, batch size, MDN components, bootstrap count, dropout, learning rate, and weight decay. capacity=0 is the smallest useful preset; capacity=1 is the largest preset. Learning rate is scaled downward in log space as capacity increases.

Explicit encoder, decoder, policy, n_bootstrap, or generation_decode_mode arguments override the preset where supplied.

Independent columns use one encoder-decoder member per feature. Columns declared in a shared numerical group instead use one full-data encoder for the group and retain target-specific decoders. Bootstrap members are kept separate and are used for confidence diagnostics and out-of-bag calibration, not for defining the neighbour-search geometry used by sample(). Set bootstrap=False for generation-only runs to skip fitting bootstrap members while still fitting the full-data generation member:

model = MIMIC(mode="factorised", capacity=1.0, bootstrap=False, random_state=0)
synthetic = model.fit(df).sample(1000)

Parallelism has two layers. n_jobs is passed to compatible underlying estimators such as random forests, while feature_n_jobs parallelizes MIMIC's independent feature-module fitting across target columns. Shared groups train as single group-level models and are not split by feature_n_jobs. Keep one outer layer high at a time: for example, when cross-validation folds are already parallel, leave feature_n_jobs=1; when fitting one model at a time, increase feature_n_jobs to train target features concurrently.

Set verbose=True to print constructor hyperparameters immediately and fitted data/embedding sizes during fit.

show_progress=True is the default. It displays an overall MIMIC fit bar and, for shared numerical groups, an epoch bar with validation loss. Set show_progress=False for quiet batch jobs, tests, or redirected logs.

Calibration is opt-in. When enabled, MIMIC uses out-of-bag bootstrap predictions from fit() to calibrate confidence outputs. Calibration therefore requires bootstrap members; leave bootstrap=True when using these diagnostics:

model = MIMIC(
    classification_calibration="temperature",  # or "isotonic"
    regression_calibration="conformal",
)
model.fit(df)
confidence = model.confidence(df)
calibration = model.calibration_report()

Classification calibration adjusts reported probabilities. Regression conformal calibration adds interval columns such as lower_90 and upper_90 to confidence().

Synthetic generation can choose how generated embeddings are decoded back to rows with generation_decode_mode:

  • "auto" preserves the default behaviour, using direct deterministic decoding for ordinary decoders and factorised stochastic decoding for conditional samplers.
  • "direct" uses feature-wise point predictions from the generated embedding.
  • "factorised" samples each non-conditioned feature from a fitted conditional sampler such as ForestConditionalSampler or NeuralConditionalSampler.
  • "joint" uses NeuralConditionalSampler evidence from all feature-wise conditionals and a deterministic neural row decoder. It must be requested explicitly and trains on complete modelled rows.

Installation

Install the published package:

python -m pip install mimic-tabular

The distribution is named mimic-tabular; its Python import package remains mimic. To work from a source checkout, install it in editable mode from the repository root:

python -m pip install -e .

For notebook and test dependencies:

python -m pip install -e ".[dev]"

Project Structure

Path Purpose
src/mimic/ Main installable tabular modeling package.
src/mimic_vision/ Image dataset and synthesis helpers used by the image workflows.
src/mimic_experiments/ Small experiment entry points distributed with the package.
tests/ Tests for the installable packages.
notebooks/ Core package tutorials and usage examples.
image_workflows/ Image-specific notebooks and their workspace guide.
docs/ User, contributor, design, and release documentation.

See docs/DEVELOPMENT.md for setup and contribution guidance. Downloaded datasets and local run data belong under the ignored root-level data/ directory. The built documentation site is generated under site/ and is not source content.

The documentation guides are Getting started, Development, Implementation, Research white paper, MIMIC for Images, and Versioning.

Development

Run the test suite with:

pytest

The notebooks provide examples for basic usage, classification and regression, generation, oversampling, traceability, and alternative encoder/decoder choices.

Versioning

The package follows Semantic Versioning while its API is evolving. See docs/VERSIONING.md for the release process and CHANGELOG.md for release notes. The current version is available as mimic.__version__ and with mimic-data --version.

Status

MIMIC is an experimental research-oriented codebase. The public API is compact, but individual modelling components are still intended to be interchangeable as the framework evolves.

Metadata

Release files for mimic-tabular 0.1.4

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

Source distribution (sdist)

Source distribution for mimic-tabular 0.1.4
File Size Uploaded Provenance Actions
mimic_tabular-0.1.4.tar.gz 104.3 kB With provenance Details for mimic_tabular-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mimic-tabular 0.1.4
File Interpreter ABI Platform Actions
mimic_tabular-0.1.4-py3-none-any.whl Python 3 none any Details for mimic_tabular-0.1.4-py3-none-any.whl

Total release size: 193.8 kB

Release files / mimic_tabular-0.1.4.tar.gz

Download URL mimic_tabular-0.1.4.tar.gz
Size 104.3 kB
Tags Source
SHA-256 checksum
How to use checksums
55f1490c74ec28b16ce927a58e50c9fbd2568d3dcc572e16afa80165b658ec80
BLAKE2b-256 checksum
How to use checksums
203d6b554710986ab9e12093b3c886bc6671df85354fc3d988e8c6a714fd9c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

Release files / mimic_tabular-0.1.4-py3-none-any.whl

Download URL mimic_tabular-0.1.4-py3-none-any.whl
Size 89.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4098f635ec427950f749ed773ba0c17d06d99e3cd1fd5f270986373cc4d719d3
BLAKE2b-256 checksum
How to use checksums
d779fb5aec95b27468f9436ae8790f3ffaff0c2c4bd342133a1f76871ae66666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

Security for mimic-tabular 0.1.4

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 mimic_tabular-0.1.4.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 Nov 22, 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.

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