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.
Questo esercizio fa parte del corso
Introduction to Deep Learning with PyTorch
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Model with Dropout
model = nn.Sequential(
nn.Linear(8, 6),
nn.Linear(6, 4),
____)
# Forward pass in training mode (Dropout active)
model.____
output_train = ____