Skip to content

Examples

In short

  • Each example is a complete Python walkthrough, from a fitted model to its explanations.
  • Start with Explain an ml4 model if your model comes from ml4, or Bring-your-own-model if it comes from elsewhere.
  • Every example uses one of two calls: fit_profiler for a supported model, or monitor_predictions for any other scorer.
  • The examples assume the named input datasets exist; swap in your own table.

ml4 builds models; mli explains them. Most examples train a plain library model to keep the focus on mli. A model trained with ml4 works the same way once you have picked the tree to explain.

Walkthroughs

Example What it covers
Explain an ml4 model Profile the best readable tree of an ml4 pipeline, in business column names, and explain a new row with the deployed pipeline
Binary classification (fraud) Archetypes, rules, explanations, EDA, held-out evaluation, trust and a model card on a fraud classifier
Multiclass classification One-vs-rest archetypes and rules, class-specific results, trust and a model card
Regression cohorts Profile a high-value tail through target_mask, with per-archetype residual diagnostics
Bring-your-own-model Native and lite paths, depending on whether mli has an adapter for your model

The two entry points

Call When What you get
fit_profiler(model=..., X=..., y=..., config=...) Your model has a native adapter: CatBoost, LightGBM, XGBoost, scikit-learn ensembles and linear models, HistGradientBoosting, EBM, RuleFit, including the trees inside ml4 Native profiling and the optional stages you request. SHAP, geometry and rule support vary by family
monitor_predictions(...) Any other scorer, or predictions only The lite path: surrogate, error tree, archetype-lite, metrics, drift and fairness

A supervised run builds one ProfilingConfig and calls fit_profiler(..., config=...) once. Report files go to ReportConfig(output_dir=...). Save a result with result.save(...) and reload it with ProfilingResult.load(...); to read a saved result without refitting, see Consuming saved results.

ml4 clustering, anomaly and forecasting results are drawn through parleml_mli.unsupervised and parleml_mli.forecasting instead of fit_profiler. See Interactive visualizations.

Next