Module

pycaret.plots.classification

Plotly-native classification diagnostics.

Each function takes a fitted classifier (or Pipeline) plus a holdout set and returns a plotly.graph_objects.Figure. No file I/O, no matplotlib — figures travel as JSON to the React dashboard.

Usage::

from pycaret.plots import classification as plots

fig = plots.confusion_matrix(pipeline, X_test, y_test)
fig.show()           # notebook
fig.to_dict()        # API JSON payload

Functions 8

confusion_matrix(estimator: Any, X: Any, y: Any, labels: list | None = None, normalize: str | None = None, title: str | None = 'Confusion matrix') -> go.Figure

Per-class confusion matrix as a heatmap.

Parameters#

estimator : fitted classifier or Pipeline X, y : holdout features + true labels labels : optional ordered class labels; otherwise derived from y normalize : None | "true" (per-row) | "pred" (per-col) | "all"

roc_curve(estimator: Any, X: Any, y: Any, title: str | None = 'ROC curve') -> go.Figure

ROC curve(s), one per class for multiclass.

pr_curve(estimator: Any, X: Any, y: Any, title: str | None = 'Precision-Recall curve') -> go.Figure

Precision-recall curve(s), one per class for multiclass.

calibration_curve(estimator: Any, X: Any, y: Any, n_bins: int = 10, title: str | None = 'Calibration curve') -> go.Figure

Reliability diagram: predicted probability vs observed frequency.

Binary classification only. For multiclass, run one-vs-rest yourself.

threshold_curve(estimator: Any, X: Any, y: Any, title: str | None = 'Threshold sweep') -> go.Figure

Precision / recall / F1 / accuracy as a function of the decision threshold. Binary classification only.

lift_curve(estimator: Any, X: Any, y: Any, title: str | None = 'Lift curve') -> go.Figure

Cumulative lift over random by decile of predicted probability.

Binary classification only.

gain_curve(estimator: Any, X: Any, y: Any, title: str | None = 'Gain curve') -> go.Figure

Cumulative gains: % positives captured by top X% of population.

Binary classification only.

class_distribution(y: Any, title: str | None = 'Class distribution') -> go.Figure

Histogram of class counts in the target. Useful for spotting imbalance.