Skip to main content

Python implementation of CATDAP (CATegorical Data Analysis Program)

Project description

pycatdap

PyPI version Python versions CI Docs License: MIT

AIC-based EDA and ML error analysis library for categorical data.

pycatdap is a Python implementation of CATDAP (CATegorical Data Analysis Program), developed by Sakamoto & Katsura (1980) at the Institute of Statistical Mathematics. It extends the classic CATDAP toolkit with modern exploratory data analysis (EDA) and machine learning error analysis workflows.

📖 Documentation: https://nbx-liz.github.io/pycatdap/

Why pycatdap?

Unlike general profilers (ydata-profiling, Skrub) or slice discovery tools (DivExplorer, pysubgroup), pycatdap uses AIC as its core relevance measure. This gives it four unique advantages:

Feature Most tools pycatdap
Variable relevance Cramér's V, mutual info AIC — explicit info-vs-complexity trade-off
Continuous binning Equal-width or quantile AIC-optimal binning
Subset discovery Feature importance ranking CATDAP-02 combinatorial search
Model coupling Tied to specific frameworks Model-agnostic (works with y_true, y_pred from anywhere)

Installation

# Core
pip install pycatdap

# With visualization (matplotlib)
pip install "pycatdap[plot]"

# With interactive Plotly figures + HTML reports
pip install "pycatdap[plotly]"

Supported: Python 3.10 / 3.11 / 3.12 / 3.13

Quickstart

Classic CATDAP

import pycatdap

df = pycatdap.datasets.load_health_data()

# CATDAP-01: pairwise AIC analysis
result = pycatdap.catdap1(df, response_names=["symptoms"])
print(result.aic_order["symptoms"])  # variables ranked by ΔAIC

# CATDAP-02: best explanatory subset
result2 = pycatdap.catdap2(
    df,
    pool=[2, 2, 2, 0, 0, 0, 0, 2],
    response_name="symptoms",
    accuracy=[0., 0., 0., 1., 1., 1., 0.1, 0.],
)
for s in result2.subsets[:3]:
    print(f"AIC={s.aic:.2f}, vars={s.variables}")

EDA (planned, v0.3+)

# Coming in v0.5
profile = pycatdap.profile(df, response="symptoms")
profile.to_html("report.html")
profile.show()  # Jupyter inline

ML error analysis (planned, v0.8+)

# Coming in v0.8
result = pycatdap.error_analysis(
    df=test_df,
    y_true=y_test,
    y_pred=model.predict(X_test),
)
result.show()                       # Jupyter
result.to_html("errors.html")       # standalone report
result.top_slices                   # natural-language cohort descriptions

Status & Roadmap

Version Theme
v0.2.0 ✅ Core CATDAP-01/02 (released)
v0.3.0 — v0.6.0 EDA workflow (Plotly backend, profile, target analysis)
v0.7.0 — v0.11.0 ML error analysis (slice discovery, calibration, drift)
v0.12.0 LizyStudio integration
v1.0.0 API stabilization

Full roadmap: PLAN.md · Meta Issue #11

Development

git clone https://github.com/nbx-liz/pycatdap.git
cd pycatdap
uv sync --all-groups
uv run pytest                                  # tests (excluding slow R cross-validation)
uv run pytest -m slow                          # slow tests (requires R + catdap package)
uv run python -m mkdocs serve                  # local docs preview
make ci                                        # ruff + mypy + pytest + build

Contributing guidelines: CONTRIBUTING.md

Project structure

Document Purpose
BLUEPRINT.md Canonical specification (Japanese)
HISTORY.md Proposal-to-decision log (Japanese)
PLAN.md Development roadmap (Japanese)
CHANGELOG.md Release history
docs/ Published documentation site

Citation

If you use pycatdap in research, please cite the original CATDAP work:

@article{sakamoto1980categorical,
  title={Categorical Data Analysis by AIC},
  author={Sakamoto, Yosiyuki and Katsura, Koichi},
  journal={Mathematical Sciences},
  year={1980}
}

License

MIT

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

pycatdap-0.3.0.tar.gz (330.8 kB view details)

Uploaded Source

Built Distribution

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

pycatdap-0.3.0-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file pycatdap-0.3.0.tar.gz.

File metadata

  • Download URL: pycatdap-0.3.0.tar.gz
  • Upload date:
  • Size: 330.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycatdap-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6e358298567ec37648db8c8aaabd9762c9f83d09052d3fbafddfe36d24e87cdb
MD5 1c0a6ccc05b9b10556bee89903f179c1
BLAKE2b-256 fdea0d60924d26e0a2e71d91425b10948e93f7036f5b11f48953dff05099961e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycatdap-0.3.0.tar.gz:

Publisher: release.yml on nbx-liz/pycatdap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycatdap-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pycatdap-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycatdap-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc63d1ee6f217f7d584c7ffc7a50132d7f9440993539cb3216556e3df7d5d885
MD5 245c661cb3b19c2d98b8cd40a1da17dd
BLAKE2b-256 5add54c94e3bf863054dadf9e7d219ca3bbf73353a0e43569c242bd22bdd6452

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycatdap-0.3.0-py3-none-any.whl:

Publisher: release.yml on nbx-liz/pycatdap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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