coco_pipe.viz.plot_roc_curve#

coco_pipe.viz.plot_roc_curve(result_or_curve, model=None, fold=None, title=None, ax=None, figsize=None, mean_only=False)#

Plot receiver-operating-characteristic curves.

Parameters:
  • result_or_curve (Any) – Experiment result with get_roc_curve() or a DataFrame containing Model, FPR, and TPR. Optional Fold and Class columns are used for grouping.

  • model (str | None) – Optional model name to display.

  • fold (int | None) – Optional fold index to display.

  • title (str | None) – Optional axes title. Defaults to "ROC Curve".

  • ax (Axes | None) – Existing Matplotlib axes to draw into.

  • figsize (tuple[float, float] | None) – Figure size used when creating a new axes.

  • mean_only (bool) – If True, interpolate fold curves onto a common x-grid and draw the mean curve with a standard-deviation band.

Returns:

The created or reused figure and axes.

Return type:

tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]

See also

coco_pipe.viz.interactive.decoding.plot_roc_curve

Interactive Plotly version.

plot_pr_curve

Precision-recall curve.

plot_calibration_curve

Probability calibration reliability curve.

plot_confusion_matrix

Predicted-vs-true class heatmap.

Examples

>>> import numpy as np, pandas as pd
>>> from coco_pipe.viz import decoding as viz
>>> df = pd.DataFrame(
...     {
...         "Model": "SVM",
...         "FPR": np.linspace(0, 1, 10),
...         "TPR": np.linspace(0, 1, 10) ** 0.5,
...     }
... )
>>> fig, ax = viz.plot_roc_curve(df)