Answer key for educators

Scoring criteria for the check questions and sample answers for the Colab assignments of Deep Learning A to Z, parts 3-1 to 3-8

If you are a learner, try the check questions in each part first, then look here. Assignment results can vary slightly by environment, so instructors should run the code once themselves before class to check the numbers.

3-1How AI Works

Back to the Educator Tips on the 3-1 page

Check question answers and scoring criteria

Q1. Using the word "feature," distinguish machine learning from deep learning in one sentence each.

Q2. The training data contains "lighting gets darker" scenes, so why does feature A still get those scenes wrong?

Q3. Which human sense goes straight to the cerebral cortex without passing through the thalamus?

Q4. What do the fruit fly's LPLC2 and feature B from Section 3 have in common?

Q5. What is wrong with the judgment "We got 100% accuracy on the training data, so it will work well in the field too"?

Sample answers for the Colab assignments

Basic assignment: add "approaching at an angle"

Challenge assignment: my own work data

Frequently asked questions in class

3-2Building Blocks of Neural Networks

Back to the Educator Tips on the 3-2 page

Check question answers and scoring criteria

Q1. If you stack 10 hidden layers in a neural network without activation functions, what kind of boundary can it draw? (2 points)

Q2. Why does using ReLU instead of sigmoid reduce vanishing gradients? (2 points)

Q3. If the label is 1 and the prediction is 0.41, what are the MSE loss and ∂L/∂y? (2 points)

Q4. Training loss keeps going down, but validation loss starts rising at some point. What is happening, and what should you do? (3 points)

Q5. In an inspection with a 10% defect rate, what are the accuracy and recall of a model that answers "all normal"? (2 points)

Sample answers for the Colab assignments

Basic assignment: tanh → ReLU, 4, 16 and 64 hidden neurons

Challenge assignment: 6:2:2 evaluation on my own work data

3-3Images and CNNs

Back to the Educator Tips on the 3-3 page

Check question answers and scoring criteria

Q1. If you feed a 224×224 color photo into an MLP with 1,000 hidden neurons, how many weights does the first layer have? (excluding biases)

Q2. If you apply a 3×3 filter to a 6×6 input with no padding and a stride of 1, what is the output size?

Q3. Show by calculation why the output is −3 when the vertical edge filter from Section 5 is placed at the top-left position.

Q4. What are the max pooling and average pooling values of the 2×2 window [6, 3, 0, 3]?

Q5. If you shuffle the pixels with a fixed rule and train from scratch, which drops more, the MLP or the CNN, and why?

Sample answers for the Colab assignments

Basic assignment: add a diagonal filter

Challenge assignment: data augmentation

Frequently asked questions in class

3-4Speech

Back to the Educator Tips on the 3-4 page

Check questions

Sample assignment answers

3-5Text

Back to the Educator Tips on the 3-5 page

Check questions

Sample assignment answers

3-6Time Series & Stock Prices

Back to the Educator Tips on the 3-6 page

Check questions

Sample assignment answers

Note for running the class. At the start and end of class, state clearly that "this is an educational example, not investment advice." If a student asks for buy or sell judgments on a specific stock, tell them it is outside the scope of this page.

3-7Sequence Models

Back to the Educator Tips on the 3-7 page

Check question answers and scoring criteria

Q1. If you average a sequence and feed it into a feedforward neural network, what information is lost?

Q2. If you feed 1, 0, 0 into h_t = tanh(x_t + 0.9·h_(t−1)), what are h_1 and h_2?

Q3. If f = σ(5) ≈ 0.9933 and the input gate is fully closed, how many times the initial value is the cell state at step 20?

Q4. With 16 hidden units and 1 input, how many parameters do the recurrent layers of SimpleRNN, LSTM and GRU (textbook formula) have?

Q5. An LSTM failed at T = 100. Can you conclude that "LSTMs cannot hold long memories"?

Sample answers for the Colab assignments

Basic assignment: keep the input gate always open (i = σ(5))

Challenge assignment: turn the T = 100 failure into success

Frequently asked questions in class

3-8Attention & Transformers

Back to the Educator Tips on the 3-8 page

Check question answers and scoring criteria

Q1. With q = [2, 0.4], k = [2, 0] and d_k = 2, what is the score q·k / √d_k?

Q2. What is the softmax of the scores [1.98, 1.98, 2.772], and the result of mixing V = [10,0], [0,10], [6,6]?

Q3. Using only self-attention without positional encoding, what happens to each word's output when the word order is shuffled?

Q4. How many parameters does a multi-head attention layer with d = 512 have, and what changes if you switch to 16 heads?

Q5. If the length goes from 4,096 → 8,192, how does the number of attention scores change?

Sample answers for the Colab assignments

Basic assignment: don't divide by √d_k

Challenge assignment: remove the positional embedding

Frequently asked questions in class