0Pricing
Deep Learning Academy · บทเรียน

ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ

คำนวณเกรเดียนต์บนกระดาษแล้วตรวจสอบด้วยโค้ด

ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Our Tiny Network

Let's hand-trace the smallest net: one input x, one weight w, no bias. The output is simply y = w times x. Tiny enough to do on paper.

y = w * x

Add a Simple Loss

We compare the output to a target t with squared error. This loss punishes being far from the target and is easy to differentiate by hand.

loss = (y - t) ** 2

Forward With Numbers

Plug in x = 2, w = 3, t = 10. Forward gives y = 6 and loss = (6 - 10) squared = 16. Now we walk backward to find dloss/dw.

Step One: Loss to Output

First link: how does loss change with y? The derivative of (y - t) squared is 2(y - t), which here is 2 times (6 - 10) = -8.

dloss_dy = 2 * (y - t)

Step Two: Output to Weight

Second link: how does y change with w? Since y = w times x, dy/dw is just x, which is 2 in our example.

dy_dw = x

Chain the Two Together

The chain rule multiplies the links: dloss/dw = dloss/dy times dy/dw = -8 times 2 = -16. That single number is our gradient.

dloss_dw = dloss_dy * dy_dw

Read the Gradient's Sign

A negative gradient means increasing w would lower the loss. So we should nudge w upward to do better next time.

Take One Update Step

With a learning rate of 0.1, the update is w = w - 0.1 times (-16) = 3 + 1.6 = 4.6. The weight moved toward a better value.

w = w - lr * dloss_dw

Confirm It Improved

Redo the forward pass with w = 4.6: y = 9.2 and loss = (9.2 - 10) squared = 0.64. Far below 16, so the step truly helped.

Check It in PyTorch

PyTorch gets the same gradient automatically. Set requires_grad on w, run forward, call backward, and read w.grad to see -16.

w = torch.tensor(3.0, requires_grad=True)
loss = (w * 2 - 10) ** 2
loss.backward()
print(w.grad)

Same Steps, Bigger Nets

A million-weight net does exactly this, just with more links chained together. The math you did by hand scales straight up.

Quick Check

Let's check your hand trace.

Recap

You traced a tiny net: forward for values, then backward multiplying local derivatives to get the gradient, then one step that lowered the loss. ✏️

คำถามที่พบบ่อย

บทเรียน “ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ”

คำนวณเกรเดียนต์บนกระดาษแล้วตรวจสอบด้วยโค้ด คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม

ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. กฎลูกโซ่ทีละชั้น
  2. การส่งต่อเก็บแคช การย้อนกลับนำกลับมาใช้
  3. ทำการแพร่ย้อนกลับของโครงข่ายเล็ก ๆ ด้วยมือ
  4. เกรเดียนต์หายและเกรเดียนต์ระเบิด
← กลับไปที่ Deep Learning Academy