Dropout: สุ่มตัดเซลล์ประสาท
บังคับให้โมเดลมีความซ้ำซ้อนเพื่อการใช้งานทั่วไป
Dropout: สุ่มตัดเซลล์ประสาท เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
What Dropout Does
Dropout randomly turns off some neurons during each training step, so the network cannot lean on any single unit too heavily. 🎲
Why Random Drops Help
By dropping neurons at random, dropout forces the network to build redundant paths, which spreads knowledge and improves generalization.
The Dropout Rate
The dropout rate p is the chance each neuron is dropped. A value like 0.5 means roughly half the units are silenced each step.
Add It in PyTorch
You add dropout with one layer. Place nn.Dropout between linear layers to regularize the activations flowing through.
self.drop = nn.Dropout(p=0.5)
x = self.drop(torch.relu(self.fc1(x)))Drops Change Every Step
Each forward pass drops a different random set of neurons, so the model effectively trains a huge ensemble of thinner networks.
Scaling Keeps It Fair
To keep the average signal steady, PyTorch scales the surviving activations up during training, so test-time outputs stay balanced.
Turn It Off at Eval
Dropout must be disabled during evaluation. Calling model.eval() switches it off so every neuron contributes to the prediction.
model.eval()
with torch.no_grad():
preds = model(x_val)Choosing a Rate
Common rates sit between 0.2 and 0.5. Higher values regularize more but can starve the network of signal if pushed too far.
Where to Place It
Put dropout on wide hidden layers where overfitting bites hardest. It is rarely applied right before the final output.
Dropout and CNNs
For convolutional features, plain dropout helps less. Many vision nets prefer Dropout2d or rely on batch norm instead.
A Cheap, Strong Tool
Dropout adds no extra parameters and costs almost nothing, yet it is one of the most reliable ways to shrink the train/val gap.
Quick Check
Think about what dropout should do when you evaluate the model.
Recap
You met dropout: randomly silencing neurons in training to force redundancy, then turning it off at eval for full, stable predictions. ✅
คำถามที่พบบ่อย
บทเรียน “Dropout: สุ่มตัดเซลล์ประสาท” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “Dropout: สุ่มตัดเซลล์ประสาท” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “Dropout: สุ่มตัดเซลล์ประสาท”
บังคับให้โมเดลมีความซ้ำซ้อนเพื่อการใช้งานทั่วไป คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “Dropout: สุ่มตัดเซลล์ประสาท” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม
ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- อ่านช่องว่างระหว่างชุดฝึกกับชุดตรวจสอบ
- Dropout: สุ่มตัดเซลล์ประสาท
- Batch Norm และ Layer Norm
- การเพิ่มข้อมูลเสมือนได้ข้อมูลเพิ่มฟรี