Model Evaluation Calculators

By · Last updated:

These model evaluation calculators turn a classifier’s predictions into the numbers used to judge it: accuracy, precision, recall, F1, ROC AUC and the impurity measures a decision tree uses to choose its splits. Enter counts or scores and each tool shows the formula with your numbers substituted, a chart, and Python code that returns the same value.

Which metric calculator do you need?

You haveYou wantCalculator
TP, FP, FN and TN at one thresholdAccuracy, precision, recall, specificityConfusion matrix calculator
Precision and recall, or per-class countsF1, F-beta, macro, micro and weighted averagesF1 score calculator
Labels and predicted scoresThe ROC curve, its area and a thresholdROC AUC calculator
Class counts before and after a splitEntropy, information gain and Gini impurityInformation gain calculator

Why is accuracy not enough?

Accuracy counts every correct prediction equally, which hides what happens to a rare class. If 1 in 100 cases is positive, a model that always answers “negative” is 99% accurate and finds nothing. Precision and recall look at the positive class from two sides: of the cases flagged, how many were right, and of the real positives, how many were found. The confusion matrix is where both come from.

One number from precision and recall

F1 is the harmonic mean of precision and recall, so it is high only when both are. The F-beta family lets you weight one side: F2 counts recall as more important, which suits screening, and F0.5 favours precision, which suits cases where a false alarm is costly. With more than two classes the per-class scores must be averaged, and macro, micro and weighted averages can disagree sharply on imbalanced data. The F1 score calculator reports all three side by side.

Judging a model across every threshold

Precision, recall and F1 describe a model at one decision threshold. Most classifiers output a score, and moving the threshold trades false positives against false negatives. The ROC curve plots that trade-off, and its area, the AUC, is the probability that a randomly chosen positive is scored above a randomly chosen negative. The ROC AUC calculator draws the curve from your scores and lets you inspect any threshold on it.

Behind the choice between two labels sits a conditional probability. The conditional probability calculator shows why precision, the chance of a true positive given a positive prediction, depends so heavily on how common the positive class is.

Impurity: how trees evaluate a split

Decision trees use an evaluation of their own while training. A split is good if it leaves the child nodes purer than the parent, and entropy and Gini impurity are the two usual ways to measure that. The information gain calculator computes both for any candidate split. Entropy also appears as a training loss for neural networks; see the cross-entropy loss calculator in the deep learning calculators.

Frequently asked questions

Which metric should I report?

It depends on the cost of each kind of error and on class balance. On a balanced problem accuracy is informative. On an imbalanced one, report precision and recall or F1 for the class you care about, and a threshold-free measure such as ROC AUC or average precision alongside it.

Do the results match scikit-learn?

The calculators use the same definitions as scikit-learn’s metric functions, and each page shows Python code so you can check. Where a score is undefined because a denominator is zero, the page says so instead of showing a number.

Can I use these for multi-class problems?

The F1 score calculator handles any number of classes with macro, micro and weighted averaging, and the information gain calculator accepts any number of classes and child nodes. The confusion matrix and ROC AUC calculators are for two classes.