plots.plot_prediction_set_profiles_split_by_true

plots.plot_prediction_set_profiles_split_by_true(
    cat_values,
    prediction_sets,
    y_true,
    *,
    category_order='freq',
    include_types=('one_correct', 'one_incorrect', 'two_class', 'no_set'),
    top_n=None,
    min_count=None,
    other_label='Other',
    style='grouped',
    figsize_per_col=(7, 6),
    scale=1.2,
    ncols=3,
    sharey=True,
    colors=None,
    rotate_xticks=45,
    label_order=None,
    label_names=None,
    title='Prediction Set Profiles — split by true label',
)

Plot prediction set profiles by category, with separate subplots for each true label.

Parameters

cat_values : array-like of shape (n_samples,)

Category label per sample.

prediction_sets : list of list or set

Prediction sets for each instance.

y_true : array-like of shape (n_samples,)

True class labels.

category_order : str or list = "freq"

How to order categories within each subplot.

include_types : tuple = ("one_correct", "one_incorrect", "two_class", "no_set")

Which prediction set types to include.

top_n : int = None

Keep only top-N categories.

min_count : int = None

Keep only categories with at least this many samples.

other_label : str = "Other"

Label for collapsed categories.

style : str = "grouped"

“grouped” or “stacked”.

figsize_per_col : tuple = (7, 6)

Size per subplot column.

scale : float = 1.2

Global scaling factor.

ncols : int = 3

Number of columns in subplot grid.

sharey : bool = True

Share y-axis across subplots.

colors : dict = None

Override colors.

rotate_xticks : int = 45

X-tick rotation.

label_order : list = None

Order of true labels for subplots.

label_names : dict = None

Mapping from label values to display names.

title : str = "Prediction Set Profiles — split by true label"

Overall figure title.

Returns

fig : matplotlib.figure.Figure

The figure object.

axes : numpy.ndarray of matplotlib.axes.Axes

Array of axes objects.

Examples

>>> fig, axes = plot_prediction_set_profiles_split_by_true(
...     X_test["purpose"].values,
...     prediction_sets,
...     y_test,
...     label_names={0: "No Default", 1: "Default"}
... )