Homework 3

  1. Modify train_logistic_regression from Notebook 0221 as follows: If there is a single ensemble dimension, that is the length of the ensemble shape is 1 (this was the case in the setting ensemble_shape = (10,) in the notebook), then perform the following steps:
    1. From the validation logits, get the validation probabilities. You can use the softmax method for this.
    2. Take the average of the validation probabilities along the ensemble dimension.
    3. Calculate the validation accuracy with these averaged probabilities as logits. (Recall that the argmax of logits and probabilities is the same.)
    4. Append the value you get to a list in the output dictionary at key "ensemble validation accuracy".
  2. With the updated training loop, train an ensemble of logistic regression models on the MNIST dataset.
  3. Plot the validation accuracies with a confidence band of level 99%.
  4. Also make a line plot of the ensemble validation accuracies.
  5. Show and close the canvas. If done correctly, you can see that the ensemble validation accuracies are consistently above the entire confidence band.