ParleML MLI: model interpretability¶
In short
- mli explains fitted models and the data behind them: who the model flags and why, which rules it learned, how good and how trustworthy it is.
- In the ParleML app, an experiment's Interpretation tab runs on mli, with no code. This site is for the Python library.
- Its main entry point is
fit_profiler. It returns aProfilingResultwith the analyses you asked for. For a scorer you can't open, or stored predictions, usemonitor_predictions. - It reads models from ml4 through ml4's interpretability contract, and also supported models trained elsewhere.
What it looks like¶
from parleml_mli import ExplanationsConfig, ProfilingConfig, RulesConfig, fit_profiler
result = fit_profiler(
model=clf, X=X_train, y=y_train,
target_mask=(y_train == 1), # the rows to profile: here, the positives
X_test=X_test, y_test=y_test, # held-out rows for the model evaluation
X_holdout=X_test, y_holdout=y_test, # held-out rows for the rules' Test numbers
config=ProfilingConfig(rules=RulesConfig(), explanations=ExplanationsConfig()),
)
result.summary_df # one row per archetype: size, lift, key signatures
The Quickstart walks through it end to end.
Pick your path¶
- In the app. Open an experiment's Interpretation tab (Explain and Rules). See MLI in Studio for what each one computes.
- Use the library. Install it, then follow the Quickstart.
- Bring your own model. Check what your model family supports in the supported-model guide.
- Look something up. Guides, configuration and the API reference.
What it can compute¶
| Capability | Entry point | What you get |
|---|---|---|
| Behavioural archetypes | fit_profiler |
Clusters of the target rows in tree-leaf or SHAP space, with signatures and similar cases. Bootstrap stability is opt-in. |
| Rule extraction | extract_rules |
IF-THEN rules from supported trees, with Train metrics and, given held-out rows, Test metrics and verdicts. Multiclass uses one-vs-rest. |
| Global explanations | explain |
PDP, ALE, interactions, surrogate, importance, class separation, drift, fairness and the error tree, as the model and data allow. |
| EDA & leakage | compute_eda |
Distributions, associations, missing values, outliers, duplicates and suspicious features. No model needed. |
| Evaluation | compute_model_evaluation |
Binary, multiclass and regression metrics, calibration and business-cost views. Honest numbers need out-of-sample scores. |
| Label-noise review | compute_label_noise |
Rows worth a second look, from out-of-sample probabilities. A flag is not a confirmed mislabel. |
| Trust summary | compute_trust_summary |
Nine diagnostic tiles built from the evidence you have. Missing evidence shows yellow, never as a pass. |
| Model cards | build_model_card |
A structured ModelCard. Regulatory crosswalks organise evidence; they do not establish compliance. |
| Per-case support | justifier / justify |
For one row: the prediction, its SHAP drivers, its archetype, the rules it matches and its neighbours. ICE, LOCO and counterfactuals are optional. |
| Other experiment kinds | ML4 integration | Dedicated views for forecasting, clustering, anomaly detection and association rules. |
Reading the evidence¶
- Only what you ask for is computed. An optional stage stays empty until you request it and it
succeeds. Check
result.resolve_capabilities()before you rely on one. A bareExplanationsConfig()requests PDP, permutation importance and a surrogate;ProfilingConfig(explanations=None)skips explanations entirely. - Rules need held-out rows to be trusted. Precision on the rows a rule was mined from is
in-sample. Pass
X_holdoutandy_holdoutto see whether the rules hold up. - Explanations describe the model, not the world. SHAP values and effect curves show how the model behaves. They do not establish cause.
- Separation is not drift. A PSI between the target rows and the rest measures how well they separate. Only a reference-versus-current comparison measures drift.
Details: what a saved result contains
A saved result holds the computed artifacts and, by default, the model. The full source frames go into a separate inference-data folder, only when you turn that on. Saved schemas are checked on load; a result from an incompatible version must be recomputed.
AI-written names and summaries are separate annotations, produced only through an Ask you
supply. The analyses themselves never request generated text.
Next¶
- Installation: install mli.
- Quickstart: profile a classifier, then derive its trust summary and model card.