اكتشف قوة دالة Sigmoid في الذكاء الاصطناعي. تعلم كيف تتيح اللاخطية، وتساعد في التصنيف الثنائي، وتقود تطورات التعلم الآلي!
وظيفة Sigmoid هي مكون رياضي أساسي يستخدم على نطاق واسع في مجالات التعلم الآلي (ML) و التعلم العميق (DL). غالبًا ما يشار إليها باسم "وظيفة السحق"، وهي تأخذ أي رقم ذي قيمة حقيقية كمدخل وتربطه بقيمة بين 0 و 1. هذه المنحنى المميز على شكل حرف "S" يجعلها مفيدة للغاية لتحويل مخرجات النموذج الأولية إلى احتمالات قابلة للتفسير. في سياق الشبكة العصبية (NN)، تعمل الدالة السينيّة كدالة تنشيط، حيث تضيف عدم خطية تسمح للنماذج بتعلم أنماط معقدة تتجاوز العلاقات الخطية البسيطة. على الرغم من أنها تم استبدالها إلى حد كبير بدوال أخرى في الطبقات الخفية العميقة، إلا أنها تظل خيارًا قياسيًا لطبقات الإخراج في مهام التصنيف الثنائي .
في جوهرها، تقوم الدالة السينيّة بتحويل البيانات المدخلة — التي يشار إليها غالبًا باسم logits — إلى نطاق معياري. هذا التحويل ضروري للمهام التي يكون هدفها توقع احتمالية وقوع حدث ما. من خلال تحديد الناتج بين 0 و 1، توفر الدالة درجة احتمالية واضحة.
While Sigmoid was once the default for all layers, researchers discovered limitations like the vanishing gradient problem, where gradients become too small to update weights effectively in deep networks. This led to the adoption of alternatives for hidden layers.
The utility of the Sigmoid function extends across various industries where probability estimation is required.
You can observe how Sigmoid transforms data using PyTorch, a popular library for building deep learning models. This simple example demonstrates the "squashing" effect on a range of input values.
import torch
import torch.nn as nn
# Create a Sigmoid layer
sigmoid = nn.Sigmoid()
# Define input data (logits) ranging from negative to positive
input_data = torch.tensor([-5.0, -1.0, 0.0, 1.0, 5.0])
# Apply Sigmoid to squash values between 0 and 1
output = sigmoid(input_data)
print(f"Input: {input_data}")
print(f"Output: {output}")
# Output values near 0 for negative inputs, 0.5 for 0, and near 1 for positive inputs
For those looking to train models that utilize these concepts without writing low-level code, the Ultralytics Platform offers an intuitive interface to manage datasets and train state-of-the-art models like YOLO26. By handling the architectural complexities automatically, it allows users to focus on gathering high-quality training data for their specific computer vision applications.