AI Glossary / Governance, ethics and safety / Intermediate
Empirical risk
Definition
Empirical risk is a model's average loss on a specified collection of observed examples. The loss function defines how each prediction is penalized, and the average summarizes those penalties. In machine learning, empirical risk is often calculated on training data, but the same idea can be applied to a clearly identified evaluation dataset. It is not a complete measure of business or societal risk.
What it means
The word empirical means that the quantity comes from the available sample. If a model makes predictions for one hundred labeled examples, a chosen loss assigns a number to each prediction - label pair, and the average is the empirical risk. Different losses answer different questions. A zero-or-one classification loss counts mistakes, whereas squared error penalizes numerical deviations more strongly as they grow. A low value is meaningful only with the loss, dataset, units, and use case stated. It does not automatically describe future performance.
How it works
For n examples, compute a loss for each example, add the losses, and divide by n. In standard notation, this is the sum of loss(model prediction, observed label) divided by the sample size. Expected or population risk instead averages over an underlying distribution that is usually not fully known. Empirical risk can provide evidence about that broader quantity under suitable sampling and evaluation assumptions. A model optimized on the same sample can fit its peculiarities, making training risk an optimistic guide to new cases. Held-out data helps examine generalization, provided it represents the intended use.
Three practical examples
- A classifier uses zero-or-one loss to summarize the fraction of support messages assigned to the wrong category.
- A forecasting model reports average squared error on a specified set of demand observations, with the squared units made clear.
- A team defines a cost-sensitive loss that penalizes one error type more heavily than another, then checks whether that weighting reflects the actual decision. The resulting number is still tied to the observed sample and chosen penalties.
Think of it this way
Think of averaging the penalty points earned over a practice exercise. The average summarizes how someone did under that exercise's rules, but it does not guarantee performance in every future exercise or capture consequences the scoring rules omit. The analogy is limited because model training deliberately searches for parameters that perform well on the practice set, which can make that score less representative than it first appears.
Worked example
Suppose observed numerical outcomes are 2, 4, and 6, while a model predicts 1, 5, and 4. The errors are minus one, plus one, and minus two. With squared-error loss, the individual losses are 1, 1, and 4, giving empirical risk (1 + 1 + 4)/3 = 2. With absolute-error loss on the same predictions, the losses are 1, 1, and 2, giving 4/3, approximately 1.33. Neither number contradicts the other; they summarize different penalties. If the outcome is measured in hours, squared-error risk has units of hours squared, while absolute-error risk is in hours. The larger numerical value does not by itself mean the squared-error model is worse, because the model is identical and the measurement rule changed. Comparing models requires keeping the relevant evaluation conditions consistent.
Illustrative case study
Fictional case: Pine Forecasting compares two demand models. One report presents training squared error, while another presents held-out absolute error. The project lead notices that the scores cannot support a direct ranking. The team evaluates both models on the same reserved observations using the same loss and also reviews large misses that matter operationally. It reports the dataset period and the meaning of the loss. The case illustrates clearer evidence rather than a fabricated improvement in forecast accuracy.
Common misconceptions and mistakes
Empirical risk is not the probability of any possible harm. The term risk has a specific statistical meaning here: expected or average loss under a stated rule. A zero training risk can reflect memorization, leakage, or an easy sample rather than a universally good model. Aggregate risk can also hide poor performance on a small but important subgroup. Changing the loss or sample changes the question being answered. Finally, a regularized training objective includes an additional penalty and should not be casually reported as if it were only the empirical prediction loss.
Business use
Require model reports to state the dataset, loss definition, sample size, weighting, and evaluation role. Compare alternatives under the same relevant conditions, and interpret units before discussing the magnitude of improvement. Examine important error types and subgroups rather than relying exclusively on an average. Check whether the loss captures operational costs sufficiently for the decision, while recognizing that some consequences need separate review. Keep training results distinct from held-out evaluation. When new use conditions differ from the sample, gather additional evidence instead of assuming the empirical value transfers unchanged.
People also ask
Is empirical risk always classification error?
No. It depends on the loss function; squared error, absolute error, and log loss are other examples.
Can it be calculated on test data?
Yes, as an observed average loss on that dataset, but the dataset's role should be named clearly.
Does a larger dataset guarantee an accurate estimate of future loss?
No. Representativeness, dependence, leakage, and changes in deployment conditions still matter. More observations do not automatically fix a systematically unsuitable sample.
Check your understanding
A model's loss values on four examples are 0, 2, 2, and 4. What is its empirical risk using an unweighted average?
Answer: The losses total eight, and eight divided by four is two. This describes those examples under that loss, not a guaranteed future risk.
Related terms
- Loss function
- Training error
- Generalization
- Empirical risk minimization
- Test set
- Sample weighting
- Regularization
- expected risk
- model evaluation
Learn next
Choose a small set of predictions and calculate two different losses by hand. Explain what each penalty rewards or discourages. Then label the dataset's role and identify one important consequence that neither average captures.
More in Governance, ethics and safety
- Ecological Fallacy Bias - The ecological fallacy is the mistake of treating a relationship or characteristic observed for groups as if it necessarily held for individuals within...
- Edge case - An edge case is an input or situation near the limits of a system's assumptions, rules, or operating conditions, or an unusual combination that challenges...
- Emergent Bias - Emergent bias is systematic unfairness that becomes apparent through the interaction of a computer system with its real context of use, particularly as...
- Emulation - Emulation is the reproduction of relevant behavior of one system by another system so that software, users, or connected components can interact with the...
- Equality of opportunity - In binary machine-learning fairness, equality of opportunity usually means that the true-positive rate is the same across the groups being compared.
- Equalized odds - Equalized odds is a statistical fairness criterion requiring a model's predictions to be independent of group membership once the actual target outcome is...
Sources
Aalto Dictionary of Machine Learning, empirical risk and ERM entries: https://aaltodictionaryofml.github.io/ADictML_Main.pdf Shalev-Shwartz and Ben-David, Understanding Machine Learning, author-hosted book: https://www.cs.huji.ac.il/~shais/UnderstandingMachineLearning/understanding-machine-learning-theory-algorithms.pdf
Previous: Empirical loss Next: Empirical risk minimization