0Pricing
Deep Learning Academy · درس

إجراء Backprop لشبكة صغيرة يدويًا

احسب التدرجات على الورق وتحقّق منها في الشيفرة

إجراء Backprop لشبكة صغيرة يدويًا درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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. ✏️

الأسئلة الشائعة

هل درس «إجراء Backprop لشبكة صغيرة يدويًا» مجاني؟

نعم — نص درس «إجراء Backprop لشبكة صغيرة يدويًا» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

ماذا ستتعلم في «إجراء Backprop لشبكة صغيرة يدويًا»؟

احسب التدرجات على الورق وتحقّق منها في الشيفرة تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟

لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «إجراء Backprop لشبكة صغيرة يدويًا»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟

نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. قاعدة السلسلة، طبقة بعد طبقة
  2. التخزين المؤقت في المرور الأمامي وإعادة الاستخدام في العكسي
  3. إجراء Backprop لشبكة صغيرة يدويًا
  4. التدرجات المتلاشية والمتفجرة
← العودة إلى Deep Learning Academy