Exercise

Creating the best model

In this exercise, you will practice designing, training, and evaluating a model. You are provided with a train_and_evaluate() function, which takes the following arguments:

  • model: (nn.Sequential() container) PyTorch model
  • learning_rate: (float) learning rate. Default to 0.01.
  • num_epochs: (int) number of training epochs. Default to 10.
  • momentum: (float) optimizer momentum. Default to 0.
  • weight_decay: (float) weight decay. Default to 0.

You will pick different hyperparameters to try to get the maximum possible validation accuracy. The model takes N x 32 x 32 x 3 batched images as inputs and outputs N x 3, where N is the batch size. It does not use the softmax function as the last activation function.

The torch.nn package is already imported as nn. The torchvision transforms package is already imported as transforms.

Instructions 1/3

undefined XP
    1
    2
    3
  • Choose a learning rate and run training and evaluation.