OCDocker.OCScore.Analysis.Plotting.MetricsPlots module

Core metric plots (ROC/PR/enrichment) for Analysis.

Usage:

from OCDocker.OCScore.Analysis.Plotting import MetricsPlots as PlottingMetrics

OCDocker.OCScore.Analysis.Plotting.MetricsPlots.enrichment_plot(y_true, y_score, fractions=(0.01, 0.02, 0.05, 0.1), *, size=(6, 4))[source]

Plot an enrichment curve: normalized cumulative hits vs. ranked-list fraction.

Draws vertical markers at requested fractions to ease reading the curve.

Parameters:
  • y_true (array-like of shape (n_samples,)) – Binary ground-truth labels (0/1 or boolean).

  • y_score (array-like of shape (n_samples,)) – Continuous prediction scores (higher = more positive).

  • fractions (Iterable[float], optional) – Fractions of the ranked list to annotate with vertical lines. Default: (0.01, 0.02, 0.05, 0.1).

  • size (tuple(float, float), optional) – Figure size in inches (width, height). Default: (6, 4).

Returns:

Matplotlib figure and axes objects.

Return type:

tuple(Figure, Axes)

OCDocker.OCScore.Analysis.Plotting.MetricsPlots.pr_plot(y_true, y_score, *, size=(6, 4))[source]

Plot a Precision–Recall curve with AP in legend.

Parameters:
  • y_true (array-like of shape (n_samples,)) – Binary ground-truth labels (0/1 or boolean).

  • y_score (array-like of shape (n_samples,)) – Continuous prediction scores (higher = more positive).

  • size (tuple(float, float), optional) – Figure size in inches (width, height). Default: (6, 4).

Returns:

Matplotlib figure and axes objects.

Return type:

tuple(Figure, Axes)

OCDocker.OCScore.Analysis.Plotting.MetricsPlots.roc_plot(y_true, y_score, *, size=(6, 4))[source]

Plot a ROC curve with AUC in legend.

Parameters:
  • y_true (array-like of shape (n_samples,)) – Binary ground-truth labels (0/1 or boolean).

  • y_score (array-like of shape (n_samples,)) – Continuous prediction scores (higher = more positive).

  • size (tuple(float, float), optional) – Figure size in inches (width, height). Default: (6, 4).

Returns:

Matplotlib figure and axes objects.

Return type:

tuple(Figure, Axes)