What is Empirical Risk Minimization (ERM)?

Last updated 14 November 2026

ERM is the principle behind most supervised learning: since the true data distribution is unknown, choose the hypothesis from a model class that minimizes the average loss on the training sample, using it as a proxy for the expected loss.

  • Definition:

    • Empirical risk: R_emp(h) = (1/n) Σ L(h(x_i), y_i).

    • ERM picks ĥ = argmin_{h ∈ H} R_emp(h).

  • Familiar instances: Least squares (squared loss), logistic regression (log loss), neural nets trained with cross-entropy.

  • Why it works:

    • By the law of large numbers, empirical risk converges to true risk for a fixed h.

    • Uniform convergence over H (bounded by VC dimension or Rademacher complexity) makes the minimizer generalize; this is the PAC-learning guarantee.

  • Failure mode: overfitting:

    • With a rich H and small n, ERM can drive training loss to zero while true risk stays high.

    • Fix via regularized ERM / structural risk minimization: minimize R_emp(h) + λ·Ω(h), or restrict H.

  • Practical caveat: ERM usually minimizes a surrogate loss, and it assumes training data is i.i.d. from the test distribution.

  • https://developers.google.com/machine-learning/glossary
  • https://www.geeksforgeeks.org/machine-learning/empirical-risk-minimization/
  • https://github.com/zafstojano/ml-interview-questions-and-answers/blob/main/main.tex
All Supervised Learning interview questions