Monash University · FACULTY OF COMPUTER SCIENCE

ECE5179 Chap.6 Overfitting and Regularisation

- one subject, every graph, every model, every mark
6 Chapters5-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 6 of 12 · ECE5179

Overfitting and Regularisation

This chapter gathers the unit's tools for models that fit their training data too well. It shows how training and validation curves reveal overfitting, why the test set must be kept for the final estimate, and how dropout, weight decay and other penalties restrain a model.

It then adds the practical defences from the PyTorch lessons, augmentation and transfer learning with linear probes, and ends with the metrics used to judge a classifier honestly.

In this chapter

What this chapter covers

  • 01

    Training, validation and test sets; k-fold cross-validation

  • 02

    Early stopping from validation loss

  • 03

    Dropout and inverted dropout scaling

  • 04

    Weight decay, ridge and LASSO penalties

  • 05

    Augmentation, transfer learning and linear probes

  • 06

    Accuracy, precision, recall and F1

Worked example · free

Spot overfitting on training and validation curves

Q [4 marks]. A network is trained for 30 epochs. Training loss falls throughout, while validation loss is lowest at epoch 13 and rises afterwards. Explain what the curves show, which weights to keep, and two changes that would reduce the gap. This revision mark allocation is ours and is not an official University marking scheme.
Training and validation loss over 30 epochs.Training and validation loss over 30 epochs. Training loss keeps falling, but validation loss bottoms out at epoch 13 and then rises, so stopping there keeps the model that generalises best.stop at epoch 13training lossvalidation lossepochloss
Training and validation loss over 30 epochs. Training loss keeps falling, but validation loss bottoms out at epoch 13 and then rises, so stopping there keeps the model that generalises best.
  • 1Falling training loss with rising validation loss after epoch 13 is the signature of overfitting.
  • 1Keep the weights from epoch 13, the minimum of the validation curve, which is early stopping.
  • 1Add a regulariser such as dropout or weight decay, tuning its strength on validation data.
  • 1Increase effective data through augmentation, or start from a pre-trained network and fine-tune it.
The model overfits after epoch 13, so keep those weights and add regularisation, more varied data or transfer learning; only then evaluate once on the untouched test set.
Sia tip — Decide every hyperparameter, including the stopping epoch, from validation loss; touching the test set before the final report turns it into a target.
Glossary

Key terms

Overfitting
Overfitting is fitting the training data so closely that performance on new data gets worse.
Validation set
A validation set is held-out data used to choose hyperparameters and decide when to stop training.
Weight decay
Weight decay shrinks every weight a little on each update by adding a multiple of the weight to its gradient.
Data augmentation
Data augmentation trains on label-preserving random transformations of the examples to increase their variety.
Linear probe
A linear probe trains only a new final layer on top of frozen features from a pre-trained network.
Recall
Recall is the fraction of truly positive cases that a classifier correctly identifies.
FAQ

Overfitting and Regularisation FAQ

Why must survivors be rescaled in dropout?

If units are zeroed with probability p during training but all fire at test time, the next layer receives more input at test time than it learned to expect. Inverted dropout divides the surviving activations by 1 − p during training, so the expected input is the same in both modes and the test network needs no change.

What is the difference between L2 and L1 regularisation?

An L2 penalty adds the sum of squared weights and shrinks all weights proportionally, which is why it is called weight decay. An L1 penalty adds the sum of absolute weights and tends to push small weights exactly to zero. The elastic net combines them, and the strength of either is tuned on validation data.

Why is accuracy misleading for rare classes?

When positives are rare, a model can be right most of the time simply by predicting the common class, so accuracy looks high while the cases that matter are missed. Precision and recall separate the two kinds of error, and F1 balances them in one number.

How does k-fold cross-validation choose a hyperparameter?

Split the training data into k folds, train k times with each fold held out once, and average the k validation errors for each candidate setting. Pick the setting with the lowest average, then retrain on all the training data. It uses scarce data efficiently and avoids trusting one lucky split.

Should dropout be active when evaluating a model?

No. Dropout is a training-time regulariser, so call model.eval() before validation or testing to switch it off, along with the training behaviour of batch normalisation. With inverted dropout no rescaling is needed at test time, because survivors were already divided by 1 − p during training.

Study strategy

Exam move

Sketch the three classic curves, underfit, good fit and overfit, and say for each what you would change. Practise inverted-dropout arithmetic on a small activation vector and verify the expectation for one unit. Do one weight-decay update by hand in both forms, w − η(∇L + λw) and (1 − ηλ)w − η∇L, and confirm they agree.

Finish with a confusion matrix: compute accuracy, precision, recall and F1, and argue which one a given application should prioritise. Keep a two-column table of regularisers with what each changes, the loss, the weights, the data or the architecture, and the hyperparameter that controls it. Then for each, write one sentence on how you would choose that hyperparameter using validation data, never the test set.

Working through Overfitting and Regularisation in ECE5179? Sia is AskSia’s AI Computer Science tutor — ask any ECE5179 Overfitting and Regularisation question and get a clear, step-by-step explanation grounded in how ECE5179 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 161 of your Monash University subjects - and 1,000+ Bibles across every Australian university.
Sia - your ECE5179 tutor, unlimited, worked the way the exam marks it
The full 5-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works
ECE5179 · Neural networks and deep learning - independent study guide on the AskSia Library. More Monash University subjects · Microeconomics across all universities