StudyBrixFree worksheets, study guides and courses

Artificial intelligence · lesson 4 of 4

Overfitting, regularization and data distribution

A model can fit training-specific noise or patterns that do not generalize. Compare training and appropriately held-out performance.

University8 practice questionsNotes + worked examples

Learn the ideas

Prerequisites: Training losses, validation and algebra.

Overfitting

A model can fit training-specific noise or patterns that do not generalize. Compare training and appropriately held-out performance.

Regularization

Penalties or constraints can prefer simpler parameter solutions. Their effect depends on the model, scaling and chosen strength.

Bias-variance

Model flexibility, sample size and noise influence prediction error. The tradeoff is a framework, not a universal curve guaranteed in all modern settings.

Distribution shift

New data may differ from training data. Validation should reflect the intended use, and monitoring may reveal later drift.

Worked examples

Example 1

Which pattern often suggests overfitting?

A generalization gap can indicate training-specific fit, though other problems should also be checked.

Very low training error but much worse held-out error

Example 2

For w=(3,4), calculate squared L2 norm.

3²+4²=25.

25

Check your understanding

8 questions

Decimals or fractions are accepted for numeric answers. Proofs and written responses use sample answers and require human marking. This is practice, not a protected examination.

1 Which pattern often suggests overfitting?

Show answer and explanation

Very low training error but much worse held-out error

A generalization gap can indicate training-specific fit, though other problems should also be checked.

2 For w=(3,4), calculate squared L2 norm.

Show answer and explanation

25

3²+4²=25.

3 If data loss is 2 and λ times squared L2 norm is 0.5, find the penalized objective.

Show answer and explanation

2.5

Add loss and penalty.

4 Where should regularization strength normally be selected?

Show answer and explanation

Through a suitable validation process

Regularization is a hyperparameter choice.

5 Why can feature scaling affect an L2 penalty's practical meaning?

Sample answer and marking guidance

The same prediction can require differently sized coefficients when units change. A coefficient-size penalty therefore interacts with feature scales.

Credit units and coefficient magnitudes.

6 Which is an example of distribution shift?

Show answer and explanation

Deployment inputs differ systematically from training inputs

Shift concerns the data-generating setting.

7 Why is collecting more data not a guaranteed fix for incorrect labels or leakage?

Sample answer and marking guidance

It can reproduce the same systematic defects at larger scale. The measurement or evaluation process must be corrected.

Credit systematic error versus sample size.

8 Training error is 0.05 and validation error is 0.12 in the same metric. Find validation minus training error.

Show answer and explanation

0.07

0.12−0.05=0.07.

Further reading and review references

These are reference links, not copied exercises, institutional endorsement or proof of independent review.