Recall & Review
beginner
What is the purpose of Dropout in neural networks?
Dropout helps prevent overfitting by randomly turning off some neurons during training. This forces the network to learn more robust features.
Click to reveal answer
beginner
How does nn.Dropout behave differently during training and evaluation in PyTorch?
During training, nn.Dropout randomly sets some inputs to zero. During evaluation, it passes all inputs unchanged to keep the full signal.
Click to reveal answer
beginner
What does the parameter 'p' in nn.Dropout(p) represent?
The parameter 'p' is the probability of an element being zeroed (dropped) during training. For example, p=0.3 means 30% of neurons are dropped randomly.
Click to reveal answer
intermediate
Show a simple PyTorch example of applying nn.Dropout with p=0.5 to a tensor.
import torch
import torch.nn as nn
x = torch.ones(5)
dropout = nn.Dropout(p=0.5)
dropout.train() # set to training mode
output = dropout(x)
print(output)
# Output will have about half the elements set to zero randomly.Click to reveal answer
beginner
Why is Dropout usually turned off during model evaluation?
Dropout is turned off during evaluation to use the full network capacity for predictions. Turning it off ensures stable and consistent outputs.
Click to reveal answer
What does nn.Dropout(p=0.2) do during training?
✗ Incorrect
The parameter p=0.2 means 20% of the inputs are randomly dropped (set to zero) during training.
During evaluation, nn.Dropout in PyTorch:
✗ Incorrect
Dropout is disabled during evaluation, so inputs pass through unchanged.
Why use Dropout in training a neural network?
✗ Incorrect
Dropout helps prevent overfitting by making the network less reliant on any single neuron.
If you set nn.Dropout(p=0), what happens?
✗ Incorrect
p=0 means zero probability of dropping neurons, so dropout does nothing.
Which mode must be set for nn.Dropout to actually drop neurons?
✗ Incorrect
Dropout only drops neurons when the module is in training mode.
Explain how nn.Dropout works and why it is useful in training neural networks.
Think about how turning off some neurons helps the network learn better.
You got /4 concepts.
Describe the difference in behavior of nn.Dropout during training and evaluation phases.
Consider what happens to the inputs in each phase.
You got /3 concepts.