{"id":34085875,"url":"https://github.com/ryo-asashi/midlearn","last_synced_at":"2026-03-08T23:34:43.791Z","repository":{"id":317100068,"uuid":"1065969547","full_name":"ryo-asashi/midlearn","owner":"ryo-asashi","description":"A scikit-learn compatible Python wrapper of the midr R package","archived":false,"fork":false,"pushed_at":"2026-02-05T06:48:00.000Z","size":27235,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-05T18:56:19.715Z","etag":null,"topics":["iml","interpretable-machine-learning","python","regression-models","xai"],"latest_commit_sha":null,"homepage":"https://ryo-asashi.github.io/midlearn/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryo-asashi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-28T19:46:11.000Z","updated_at":"2026-02-05T06:48:03.000Z","dependencies_parsed_at":"2025-09-28T21:26:22.685Z","dependency_job_id":"ee6765e0-5158-4736-88ce-5ed3b27c0e9e","html_url":"https://github.com/ryo-asashi/midlearn","commit_stats":null,"previous_names":["ryo-asashi/pyramid-learn","ryo-asashi/midlearn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ryo-asashi/midlearn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryo-asashi%2Fmidlearn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryo-asashi%2Fmidlearn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryo-asashi%2Fmidlearn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryo-asashi%2Fmidlearn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryo-asashi","download_url":"https://codeload.github.com/ryo-asashi/midlearn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryo-asashi%2Fmidlearn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30277037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iml","interpretable-machine-learning","python","regression-models","xai"],"created_at":"2025-12-14T13:16:33.792Z","updated_at":"2026-03-08T23:34:43.780Z","avatar_url":"https://github.com/ryo-asashi.png","language":"Python","readme":"# midlearn\n\n[![PyPI version](https://badge.fury.io/py/midlearn.svg)](https://badge.fury.io/py/midlearn)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**midlearn** is a **rpy2**-based Python wrapper for the **midr** R package. It provides a model-agnostic framework for interpreting black-box models using a **scikit-learn** compatible API.\n\nThe core objective of midlearn is to create a globally interpretable surrogate model through **Maximum Interpretation Decomposition (MID)**. This technique finds an optimal additive approximation of any black-box model (e.g., GBMs, Neural Networks) by minimizing the squared error between the original predictions and the surrogate's components.\n\n## Main Features\n\n-   **Scikit-learn Compatible API**: Fits seamlessly into existing workflows with familiar `.fit()` and `.predict()` methods.\n-   **Functional Decomposition**: Deconstructs model predictions into an intercept, main effects, and second-order interaction effects, minimizing the squared residuals.\n-   **Model Fidelity**: Quantifies the quality of the explanation and the complexity of the model using the Uninterpreted Variation Ratio.\n-   **Seamless Visualization**: Built-in support for **plotnine**-based interfaces to generate feature importance, dependence plots, and additive breakdowns.\n\n## Installation\n\n**midlearn** requires an R installation on your system with the **midr** package.\n\n### 1. Install R Package\n\nFrom CRAN:\n``` r\ninstall.packages('midr')\n```\n\nOr from GitHub:\n``` r\npak::pak(\"ryo-asashi/midr\")\n```\n\n### 2. Install Python package\n\nFrom PyPI:\n``` bash\npip install midlearn\n```\n\nOr from GitHub:\n``` bash\npip install git+https://github.com/ryo-asashi/midlearn.git\n```\n\n## Theoretical Foundation\n\nMID is a functional decomposition method that deconstructs a black-box prediction function $f(\\mathbf{X})$ into several interpretable components: an intercept $g_\\emptyset$, main effects $g_j(X_j)$, and second-order interactions $g_{jk}(X_j, X_k)$, minimizing the squared residuals $\\mathbf{E}\\left[g_D(\\mathbf{X})^2\\right]$:\n\n$$\nf(\\mathbf{X}) = g_\\emptyset + \\sum_{j} g_j(X_{j}) + \\sum_{j \u003c k} g_{jk}(X_{j},\\;X_{k}) + g_D(\\mathbf{X})\n$$\n\nTo ensure the uniqueness and identifiability of each component, MID imposes centering and probability-weighted minimum-norm constraints on the decomposition.\n\nBy approximating a black-box model with this surrogate structure, we can derive a representation that retains the superior predictive power of machine learning models without sacrificing actuarial transparency.\nFurthermore, it allows us to quantify the \"uninterpreted\" variance, i.e., the portion of the model's logic that can't be captured by low-order effects, via the residual term $g_D(\\mathbf{X})$.\n\nThe theoretical foundations of MID are described in Iwasawa \u0026 Matsumori (2026) [Forthcoming], and the software implementation is detailed in [Asashiba et al. (2025)](https://arxiv.org/abs/2506.08338).\n\n## License\n\n**midlearn** is licensed under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryo-asashi%2Fmidlearn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryo-asashi%2Fmidlearn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryo-asashi%2Fmidlearn/lists"}