Experimenting with dropout
Dropout helps prevent overfitting by randomly setting some output values to zero during training. In this exercise, you'll build a simple neural network with dropout and observe how it behaves in training and evaluation modes.
torch.nn package is preloaded as nn, and features is already defined for you.
This exercise is part of the course
Introduction to Deep Learning with PyTorch
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Model with Dropout
model = nn.Sequential(
nn.Linear(8, 6),
nn.Linear(6, 4),
____)
# Forward pass in training mode (Dropout active)
model.____
output_train = ____