Machine Learning Evaluation Metrics

Common ML evaluation metrics: Accuracy, Precision, Recall, F1 Score, ROC-AUC, MAE, MSE, and R-squared with formulas and best-use scenarios.

  • JSON9,592 B
  • YAML6,535 B · −32%
  • TOON4,948 B · −48%

Evaluation metrics for machine-learning models with type, formula, best use and range: accuracy, precision, recall, F1, ROC-AUC, MAE, MSE and R-squared, extended with specificity, log loss, RMSE, Matthews correlation, IoU, perplexity, BLEU, nDCG and Cohen's kappa.

Use it when

  • You need the formula and interpretation of a metric.
  • You are choosing a metric for imbalanced classification, ranking or generation.

Watch out for

  • A single metric hides trade-offs; report several and choose by the cost of different errors.
  • Metrics such as BLEU correlate imperfectly with human judgment of quality.
  • ROC-AUC can range from 0 to 1; 0.5 is a random ranking, not the lower bound. Report prevalence and the decision threshold alongside threshold-specific metrics.

The data

Metrics

NameTypeFormulaBest forRange
AccuracyClassification(TP + TN) / (TP + TN + FP + FN)Balanced datasets[0, 1], higher is better
PrecisionClassificationTP / (TP + FP)Minimizing false positives[0, 1], higher is better
RecallClassificationTP / (TP + FN)Minimizing false negatives[0, 1], higher is better
F1 ScoreClassification2 * (Precision * Recall) / (Precision + Recall)Imbalanced datasets[0, 1], higher is better
ROC-AUCClassificationArea under ROC curveRanking quality[0, 1]; 0.5 is the random-ranking baseline, and lower values are possible
MAERegressionmean(|y_true - y_pred|)Average error magnitude[0, inf), lower is better
MSERegressionmean((y_true - y_pred)^2)Penalizing large errors[0, inf), lower is better
R-squaredRegression1 - (SS_res / SS_tot)Proportion of variance explained(-inf, 1], higher is better
SpecificityClassificationTN / (TN + FP)Measuring how well negatives are identified[0, 1], higher is better
Log LossClassification-(1/N) * sum(y log p + (1 - y) log(1 - p))Evaluating predicted probabilities[0, infinity), lower is better
Matthews Correlation CoefficientClassification(TP*TN - FP*FN) / sqrt((TP+FP)(TP+FN)(TN+FP)(TN+FN))Imbalanced binary classification[-1, 1], higher is better
RMSERegressionsqrt(mean((y - y_hat)^2))Regression where large errors should weigh more, in the units of the target[0, infinity), lower is better
Intersection over UnionDetection and segmentation|A intersect B| / |A union B|Overlap between predicted and true regions[0, 1], higher is better
PerplexityLanguage modelingexp(-(1/N) * sum(log p(w_i | context)))Comparing language models on the same text[1, infinity), lower is better
BLEUMachine translationBrevity penalty * geometric mean of n-gram precisionsComparing translations with references[0, 1], higher is better
nDCGRankingDCG / ideal DCGSearch and recommendation quality with graded relevance[0, 1], higher is better
Cohen's KappaAgreement(p_o - p_e) / (1 - p_e)Agreement between annotators beyond chance[-1, 1], higher is better
Average PrecisionRanking / binary classificationsum((recall_n - recall_previous) * precision_n)Summarizing the precision-recall tradeoff when positives are rare[0, 1], higher is better; prevalence affects the baseline
Brier Score (binary)Probability predictionmean((p_positive - y_binary)^2)Evaluating probabilistic predictions alongside calibration plots[0, 1], lower is better
Balanced AccuracyClassificationmean(recall_per_class)Giving each class equal weight in the recall average[0, 1], higher is better
Pinball LossQuantile regressionmean(max(q * error, (q - 1) * error)); error = y_true - y_predEvaluating a specified conditional quantile[0, inf), lower is better

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
metricsnamestringAccuracy
metricstypestringClassification
metricsformulastring(TP + TN) / (TP + TN + FP + FN)
metricsbest_forstringBalanced datasets
metricsrangestring[0, 1], higher is better

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.yunusemrevurgun.com/api/dataset/ml-evaluation-metrics?format=toon"
const res = await fetch(
  "https://yjtoon.yunusemrevurgun.com/static-data/dataset/ml-evaluation-metrics.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Sources and editorial notes

Original editorial reference notes by YJTOON, informed by the linked primary documentation. External specifications retain their own licenses.

Editorial review: . Source documents keep their own licenses.

Topics

  • ml
  • evaluation
  • metrics
  • data science

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets