probly.plot.credal.plot.plot_credal_set¶
- probly.plot.credal.plot.plot_credal_set(data: ArrayCategoricalCredalSet, *, title: str | None = None, labels: list[str] | None = None, series_labels: list[str] | None = None, config: PlotConfig | None = None, show: bool = False, gridlines: bool = True, ground_truth: ArraySingletonCredalSet | None = None) Axes[source]¶
Plot an Array credal set.
For 2-class credal sets, renders a horizontal interval plot where the x-axis represents P(class 2). For 3-class credal sets, renders a ternary simplex diagram. For 4+ classes, renders a spider (radar) plot.
Dispatches to a type-specific renderer based on the concrete credal set type. For batched inputs, each element in the batch is overlaid on the same axes with a distinct color.
The following types are supported:
ArrayProbabilityIntervalsCredalSet: drawn as a filled interval (2-class), feasibility envelope (3-class), or constant-width bars on spokes (4+ classes).ArrayDistanceBasedCredalSet: drawn as a filled interval/envelope/bars with the nominal distribution marked as a point.ArrayConvexCredalSet/ArrayDiscreteCredalSet: drawn as an interval with vertex markers (2-class), convex hull envelope (3-class), or min/max envelope (4+ classes).ArraySingletonCredalSet: drawn as a single scatter marker or closed envelope on spokes.
- Parameters:
data – The credal set to plot.
title – Title of the plot.
labels – Class labels. Defaults to
["C0", "C1", ...].series_labels – Optional legend labels, one per batch element. When provided a legend is shown. Defaults to
None(no legend).config – Plot configuration. Defaults to
PlotConfig().show – Whether to call
plt.show()after plotting.gridlines – Whether to display gridlines. Used for 3-class (ternary) and 4+-class (spider) plots. Defaults to
True.ground_truth – Optional ground-truth distribution to overlay as a star marker. Must be an
ArraySingletonCredalSetwith the same number of classes asdata.
- Returns:
The matplotlib axes with the plot.
- Raises:
ValueError – If labels length does not match the number of classes.
NotImplementedError – If
datais not a supported Array credal set type.