Sigmoid وTanh: حصر القيم ضمن نطاق
المخرجات المحدودة وفخ تلاشي التدرج
Sigmoid وTanh: حصر القيم ضمن نطاق درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Squashing Activations
Some activations squeeze any input into a fixed range. The two classics are sigmoid and tanh, and both bend big numbers gently inward. 🤏
Sigmoid's Range
Sigmoid maps every value into the open interval from 0 to 1. That makes its output read naturally as a probability.
import torch
y = torch.sigmoid(x) # outputs between 0 and 1Its S-Shaped Curve
Sigmoid has a smooth S shape: near zero it changes fast, but far out it flattens. Large inputs all map to nearly the same value.
Tanh's Range
Tanh is sigmoid's cousin, but it squashes inputs into the range from minus 1 to plus 1, centered neatly on zero.
y = torch.tanh(x) # outputs between -1 and 1Why Centering Helps
Because tanh is zero-centered, its outputs balance around zero. That often gives smoother, faster learning than sigmoid for hidden layers.
The Flat Tails
Out at the edges, both curves go almost flat. A flat region means a tiny slope, and a tiny slope means a tiny gradient.
Vanishing Gradients
When gradients shrink toward zero, early layers barely update. This vanishing gradient trap stalls deep networks during training. 😴
Why ReLU Took Over
This vanishing problem is exactly why ReLU replaced sigmoid and tanh in most hidden layers. ReLU keeps a healthy gradient for positives.
Where Sigmoid Still Wins
Sigmoid stays useful at the output of a binary classifier, where you genuinely want a single probability between 0 and 1.
Where Tanh Still Wins
Tanh still appears inside recurrent cells like LSTMs, where its bounded, zero-centered output helps keep the hidden state stable.
Choosing Wisely
Rule of thumb: avoid sigmoid and tanh in deep hidden stacks, but keep sigmoid for a single probability output. Match the tool to the job.
Quick Check
Recall what happens at the flat tails of these curves.
Recap
Sigmoid squashes to 0 to 1 and tanh to minus 1 to 1. Their flat tails cause vanishing gradients, so save them for outputs and special cells. 🎯
تعلم Python مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 30
- الدروس
- 120
الأسئلة الشائعة
هل درس «Sigmoid وTanh: حصر القيم ضمن نطاق» مجاني؟
نعم — نص درس «Sigmoid وTanh: حصر القيم ضمن نطاق» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
ماذا ستتعلم في «Sigmoid وTanh: حصر القيم ضمن نطاق»؟
المخرجات المحدودة وفخ تلاشي التدرج تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟
لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «Sigmoid وTanh: حصر القيم ضمن نطاق»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- لماذا تفتح اللاخطية المجال للقوة الحقيقية
- ReLU وشقيقتاها Leaky وGELU
- Sigmoid وTanh: حصر القيم ضمن نطاق
- Softmax للاحتمالات