probly.visualization.credal.plot_3d¶
Plotting for 3 class probabilities.
Classes
Class to create ternary visualization. |
- class probly.visualization.credal.plot_3d.TernaryVisualizer[source]¶
Bases:
objectClass to create ternary visualization.
- draw_mle_prob_line(probs, ax)[source]¶
Draw probability axes for MLE for better readability.
- Parameters:
probs (np.ndarray) – Array of probability vectors used to compute the MLE.
ax (Axes) – Matplotlib Axes on which the MLE point and lines are drawn.
- Return type:
None
- label_corners_and_vertices(ax, v1, v2, v3, labels)[source]¶
Label the corners and vertices of a simplex.
- Parameters:
- Return type:
None
- plot_convex_hull(probs, ax=None)[source]¶
Draw the convex hull around the points.
Handles special cases: - 1 point (degenerate) - 2 points (line segment) - >= 3 points (polygon)
- Parameters:
probs (np.ndarray) – Array of probabilities.
ax (Axes | None) – Axes to draw on.
facecolor – Color of the convex hull.
alpha – Opacity of the convex hull.
edgecolor – Color of the outline.
linewidth – Width of the convex hull.
- Returns:
Plot with convex hull.
- Return type:
Axes
- plot_minmax_lines(probs, ax)[source]¶
Draw min/max probability lines for each class.
Up to 6 lines total (min & max for 3 classes).
- Parameters:
probs (np.ndarray) – Array of probability vectors used to compute min/max values.
ax (Axes) – Matplotlib Axes on which the envelope lines are drawn.
- Return type:
None
- ternary_plot(probs, labels, title, credal_flag, mle_flag, minmax_flag, ax=None, **scatter_kwargs)[source]¶
Plot ternary scatter points.
- Parameters:
probs (np.ndarray) – Probability vector for 3 classes.
title (str) – Title of the plot.
mle_flag (bool) – Flag to indicate whether median of probabilities is shown.
credal_flag (bool) – Flag to indicate whether convex hull is shown.
minmax_flag (bool) – Bool defaulted to true, which optionally draws upper and lower probability envelopes.
scatter_kwargs (Any) – Keyword arguments passed to scatter_kwargs.
ax (Axes | None) – Axes to draw the plot on. If None, a new Axes is created.
- Returns:
Ternary plot with scattered points.
- Return type:
Axes