Skip to contents

Computes sensitivity and specificity for binary classification tasks. Takes binary vectors of true and predicted labels. Uses the `target` value to define the positive class. Sensitivity and specificity are computed from TP, FP, FN, TN counts. Plots the results as two bars with percentage labels.

Usage

plot_sensitivity_specificity(
  y_true,
  y_selected,
  target = 1,
  title = NULL,
  x_label = NULL,
  y_label = NULL
)

Arguments

y_true

Vector of true labels (numeric, factor, or logical).

y_selected

Vector of predicted labels (numeric, factor, or logical).

target

The value that should be treated as the positive class.

title

Optional plot title.

x_label

Optional x-axis label.

y_label

Optional y-axis label (default: "Value label").

Value

A ggplot2 object showing sensitivity and specificity as bars.