plots.plot_conformal_coverage_by_class

plots.plot_conformal_coverage_by_class(
    calibration_scores,
    probs_test,
    y_test,
    alphas=None,
    cutoff_confidence=None,
    mondrian=False,
    y_calib=None,
)

Plot coverage and prediction set types broken down by true class.

This function provides a detailed view of conformal prediction performance, showing how prediction sets are distributed across confidence levels for each true class separately.

Parameters

calibration_scores : array-like of shape (n_calib,)

Nonconformity scores from the calibration set.

probs_test : array-like of shape (n_test, n_classes)

Predicted probabilities for the test set.

y_test : array-like of shape (n_test,)

True labels for the test set.

alphas : array - like = None

Alpha values to evaluate. Defaults to np.arange(0, 1, 0.1).

cutoff_confidence : float = None

If provided, draws a vertical line at this confidence level.

mondrian : bool = False

If True, compute per-class quantiles (Mondrian conformal prediction).

y_calib : array - like = None

Calibration labels. Required if mondrian=True.

Returns

fig : matplotlib.figure.Figure

The figure object.

ax : matplotlib.axes.Axes

The axes object.