Confusion matrix
Actual vs predicted classes for a classifier, with recall per row, precision per column and accuracy.
How well a model separates positives from negatives at every cut-off, with AUC, or precision-recall.
A ROC curve shows how well a model separates positives from negatives at every possible score cut-off. Each point is one cut-off: how many of the real positives it catches (true positive rate) against how many negatives it wrongly flags (false positive rate). A useless model follows the diagonal; a good one bends towards the top-left corner. The area under the curve (AUC) sums it up in one number.
You pass the raw scores and true labels and the chart does the rest, including ties. Compare up to four models on one chart, each with its AUC in the legend. A cut-off (0.5 by default for probabilities) is marked with what it means in words: catches 88% of churners, flags 6% of the rest. When positives are rare, switch to the precision-recall view, which shows how many flags are right, with average precision and a chance line at the positive rate.
To show the exact mistakes at one cut-off, pair it with a confusion matrix.
ROC curve is a Pro chart.
Installation is part of Pro
Get Pro to install it with your access key and the shadcn CLI, and use it in unlimited projects.
Unlock with ProUsage examples are part of Pro
Every example on this page comes with its code in Pro. The props and data shape below are public.
Unlock with ProOne row per scored item with a score key and a true-label key; optional model key to compare models.
[{ model: "New model", score: 0.83, churned: true }, ...]Missing values are null. Invalid values make the chart say what’s wrong instead of drawing a misleading picture. How charts handle bad data
Every chart also accepts the shared frame props: title, subtitle, source, height, mode, toolbar. Common API
export interface RocCurveProps extends FrameProps {
/** Raw predictions, one row per scored item. See the Data section for the shape. */
data: Row[];
/** Key of the model's score (higher = more likely positive), e.g. a probability. */
score: string;
/** Key of the true label. */
actual: string;
/** The value of `actual` that counts as positive. Default: true, 1, "1", "yes", "true" or "positive". */
positive?: string | number | boolean;
/** Optional key of the model name, to compare up to 4 models on one chart. */
model?: string;
/** "roc" (true positive rate vs false positive rate, default) or "pr" (precision vs recall, better when positives are rare). */
curve?: "roc" | "pr";
/** Score cut-off to mark on each curve. Default 0.5 when every score is between 0 and 1. */
threshold?: number;
}Actual vs predicted classes for a classifier, with recall per row, precision per column and accuracy.
Trends over time for one to four series, with gaps for missing data and marked forecasts.
The relationship between two measures, with groups, bubbles, quadrants and a trend line.