MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Deep Learning with PyTorch

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Model with Dropout
model = nn.Sequential(
    nn.Linear(8, 6),
    nn.Linear(6, 4),
    ____)

# Forward pass in training mode (Dropout active)
model.____
output_train = ____
Edit dan Jalankan Kode