Metrics measure a defined sample and cannot establish business impact or fairness on their own. For current product behavior, consult Google’s classification metrics reference and BigQuery ML evaluation overview.

Classification at a fixed threshold

Precision=TPTP+FP,Recall=TPTP+FN\mathrm{Precision}=\frac{TP}{TP+FP},\qquad \mathrm{Recall}=\frac{TP}{TP+FN}
TP: true positives; FP: false positives; FN: false negatives. Ratios require nonzero denominators.
FPR=FPFP+TN,Accuracy=TP+TNTP+FP+TN+FN\mathrm{FPR}=\frac{FP}{FP+TN},\qquad \mathrm{Accuracy}=\frac{TP+TN}{TP+FP+TN+FN}
TN: true negatives. FPR measures false alerts among actual negatives.
F1=2TP2TP+FP+FNF_1=\frac{2TP}{2TP+FP+FN}
F1 balances precision and recall. A zero denominator is undefined.

True positives (TP) and true negatives (TN) are correct predictions. False positives (FP) and false negatives (FN) are errors. Define which class is positive before interpreting a metric.

  • Precision: TP / (TP + FP), the share of positive predictions that are actually positive.
  • Recall: TP / (TP + FN), the share of actual positives identified.
  • False-positive rate: FP / (FP + TN), the share of actual negatives incorrectly flagged.
  • Accuracy: (TP + TN) / (TP + FP + TN + FN), the share of all predictions correct.
  • F1: 2TP / (2TP + FP + FN), a harmonic balance of precision and recall.

A denominator of zero makes the corresponding ratio undefined. Metrics change with the threshold, population, label quality, and prevalence.

WORKED EXAMPLE

TP = 30, FP = 10, TN = 50, FN = 10. Precision = 30/40 = 75%, recall = 30/40 = 75%, false-positive rate = 10/60 ≈ 16.7%, and accuracy = 80/100 = 80%.

Regression and forecasting

ei=y^i−yi,MAE=1n∑i=1n∣ei∣e_i=\hat y_i-y_i,\qquad \mathrm{MAE}=\frac{1}{n}\sum_{i=1}^{n}|e_i|
For n observations, y is the actual value and ŷ is the prediction; e is prediction minus actual.
MSE=1n∑i=1nei2,RMSE=MSE\mathrm{MSE}=\frac{1}{n}\sum_{i=1}^{n}e_i^2,\qquad \mathrm{RMSE}=\sqrt{\mathrm{MSE}}
MSE has squared target units; MAE and RMSE have the original target units.
MAE=2+4+63=4,RMSE=4+16+363≈4.32\mathrm{MAE}=\frac{2+4+6}{3}=4,\quad\mathrm{RMSE}=\sqrt{\frac{4+16+36}{3}}\approx4.32
Worked example: signed errors 2, −4, and 6.
  • MAE: average absolute error, in the target’s units.
  • MSE: average squared error, in squared units; large errors have greater influence.
  • RMSE: square root of MSE, expressed in the target’s units.

For errors of 2, −4, and 6, MAE = 4, MSE = 56/3 ≈ 18.67, and RMSE ≈ 4.32. Inspect signed errors and relevant slices as well: an average absolute error does not reveal systematic overprediction or underprediction. For forecasts, compare methods on the same historical origins and horizon without using future information.

Retrieval and index quality

For a query with five relevant documents, a system retrieving three of them in its top ten has relevance recall at ten of 3/5 = 60%. Precision at ten is 3/10 = 30%, assuming all ten returned documents were judged and exactly three were relevant.

Approximate-index recall is a different comparison: if an approximate search returns eight of the ten exact nearest neighbors under the same index inputs and filters, its index recall at ten is 80%. Exact neighbors are not automatically relevant, authorized, or current. Evaluate evidence and final answers separately.

Practice and review