Lesson 5 MNIST: why don't we need a test set?

with gzip.open(path/‘mnist.pkl.gz’, ‘rb’) as f:
((x_train, y_train), (x_valid, y_valid), _) = pickle.load(f, encoding=‘latin-1’)

In Lesson 5 during the MNIST exercise, we throw away the test set. Why don’t we need the test set here? In what cases would we need both the validation and the test set?


Training set and Validation set is always required. Because based on the training set the neural network learn and based on the validation set your model is validated and calculated your loss function and metrics (like accuracy). And the test set is only used to validate your final solution. A Test set is not used in the learning process. Below you find some info.

1 Like

Thanks. Why did we preserve the test set in https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson4-tabular.ipynb then? From what I can tell, we are just training the model in that exercise as well, not testing it. (Also, what would testing it look like? What would the Python commands be?)

For me, just show that you can. It have nothing to do with the rest of the code. By this, you can predict values learn.pred_batch(DatasetType.Test) to upload for example to your Kaggle competition and get some results.

1 Like

In this lesson, why are we using F.relu() ?
What is F in here?


F is a shortcut for the PyTorch functional library. F.relu is an activation function for the model.


import torch
import torch.nn.functional as F

tensor([[0.0000, 3.1545],
        [0.0000, 0.4526]])
1 Like

Oh, I understand.
Thanks @klemenka

1 Like