plots.plot_balanced_conformal_coverage
plots.plot_balanced_conformal_coverage(
calibration_scores,
probs_test,
y_test,
alphas=None,
cutoff_confidence=None,
mondrian=False,
y_calib=None,
)Plot class-balanced coverage and prediction set types.
Each class contributes equally (50%) to the visualization, regardless of class imbalance in the test set. This provides a balanced view of conformal prediction performance across classes.
Parameters
calibration_scores : array-like of shape (n_calib,)-
Nonconformity scores from the calibration set.
probs_test : array-like of shape (n_test, 2)-
Predicted probabilities for the test set. Must be binary classification.
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.01, 1.0, 0.01).
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.
Raises
: ValueError-
If probs_test is not for binary classification or if mondrian=True but y_calib is not provided.