monitor_predictions¶
The model-agnostic bring-your-own-predictions entry point. Given either a
generic model (any predict_proba / decision_function / predict scorer) or
a precomputed predictions array, it runs the lite pipeline — surrogate tree,
high-error cohort tree, archetype-lite segments, holdout metrics, drift (PSI)
and model-free fairness — treating the model as an opaque scorer. See the
BYO-model example.
In short
monitor_predictionstreats the model as an opaque scorer, or takespredictions=alone.- It returns a
ProfilingResultwhose backend islite_modelorlite_predictions. - For a model mli has an adapter for, call
fit_profilerinstead. - The positive class and the decision cut are resolved once and stored on
result.target_andresult.threshold_.
Prefer fit_profiler for natively supported models
For a model mli has an adapter for — CatBoost / LightGBM / XGBoost /
scikit-learn ensembles (leaf-space), or HistGradientBoosting / DecisionTree
/ EBM / RuleFit / scikit-learn linear & GLM families (SHAP-space) — call
fit_profiler directly for native profiling and requested
optional analysis. Geometry and rule support vary by family; a binary
y profiles the model's positive class (classes_[1]) without a mask. See
Supported models.
Tasks: binary, multiclass, and regression (task_type=).
Positive class and decision threshold
Both entry points resolve a binary run's positive class once
(positive_class=, else the model's classes_[1], else True / 1 /
the last of two sorted labels — the last with a warning) and its decision
cut once (served_threshold= for a deployed operating point, else
decision_threshold=: a float, "f1" / "f<beta>" to tune, or None —
the default — for the model's own decision). The answers are stored on
result.target_ and result.threshold_. positive_class= names a label
by ml4's rule — string or numeric form, so "True" names True and
"1.0" names 1.0 — and a y showing a single unconventional label
(say, all "no") with nothing naming the positive class is refused
rather than guessed.
monitor_predictions ¶
monitor_predictions(
*,
X: DataFrame,
y: ndarray | Series | None = None,
model: Any | None = None,
predictions: ndarray | Series | None = None,
X_valid: DataFrame | None = None,
y_valid: ndarray | Series | None = None,
predictions_valid: ndarray | Series | None = None,
X_test: DataFrame | None = None,
y_test: ndarray | Series | None = None,
predictions_test: ndarray | Series | None = None,
reference_df: DataFrame | None = None,
sensitive_features: DataFrame | Series | None = None,
task_type: TaskType = BINARY,
mode: Literal[
"surrogate", "error", "archetype_lite", "all"
] = "all",
decision_threshold: float | str | None = None,
served_threshold: float | None = None,
positive_class: Any = None,
surrogate_engine: "EngineKey" = "lgbm",
random_state: int = 42
) -> ProfilingResult
Interpret a model's predictions — the model-agnostic lite path.
The standalone monitoring / "bring-your-own-predictions" entry point:
given either a generic model (any object exposing
predict_proba / decision_function / predict) or a
precomputed predictions array, build a surrogate decision tree,
high-error cohort tree, archetype-lite segments, holdout metrics,
drift (PSI) and model-free fairness — without ever needing the model's
internals. This is the standalone / external-model-monitoring path for
scorers mli has no native adapter for.
For models mli recognises natively (CatBoost / LightGBM / XGBoost /
sklearn ensembles / trees / HGB) prefer :func:parleml_mli.fit_profiler: it
delivers the full surface (exact SHAP, leaf-space archetypes, rules,
PDP/ICE, counterfactuals). monitor_predictions treats the model as
an opaque scorer and works for any estimator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
DataFrame
|
Feature matrix and (optional) ground truth. |
required |
y
|
DataFrame
|
Feature matrix and (optional) ground truth. |
required |
model
|
Any | None
|
Any estimator exposing |
None
|
predictions
|
ndarray | Series | None
|
Score array aligned with |
None
|
X_valid
|
DataFrame | None
|
Holdout splits for the evaluation report. In the predictions-only
branch supply the matching |
None
|
y_valid
|
DataFrame | None
|
Holdout splits for the evaluation report. In the predictions-only
branch supply the matching |
None
|
predictions_valid
|
DataFrame | None
|
Holdout splits for the evaluation report. In the predictions-only
branch supply the matching |
None
|
X_test
|
DataFrame | None
|
Holdout splits for the evaluation report. In the predictions-only
branch supply the matching |
None
|
y_test
|
DataFrame | None
|
Holdout splits for the evaluation report. In the predictions-only
branch supply the matching |
None
|
predictions_test
|
DataFrame | None
|
Holdout splits for the evaluation report. In the predictions-only
branch supply the matching |
None
|
reference_df
|
DataFrame | None
|
Drift baseline (defaults to |
None
|
sensitive_features
|
DataFrame | Series | None
|
Group memberships aligned with |
None
|
task_type
|
TaskType
|
Lite-pipeline knobs (see :func: |
BINARY
|
mode
|
TaskType
|
Lite-pipeline knobs (see :func: |
BINARY
|
surrogate_engine
|
TaskType
|
Lite-pipeline knobs (see :func: |
BINARY
|
random_state
|
TaskType
|
Lite-pipeline knobs (see :func: |
BINARY
|
decision_threshold
|
float | str | None
|
Binary decision cut, resolved once by
:func: |
None
|
served_threshold
|
float | None
|
The deployed model's published cut; wins over
|
None
|
positive_class
|
Any
|
The positive label of a binary |
None
|
Returns:
| Type | Description |
|---|---|
ProfilingResult
|
Carries a :class: |