الرئيسية / مقرر Deep Learning / الفصل 1 الجزء 1

الفصل 1 (الجزء 1): Introduction to Deep Learning

What deep learning is, tensors, and a single artificial neuron

نبدأ على طول: الـ neuron، والـ tensors، وإزاي الشبكة بتتعلّم. شوف الرسوم المتحركة وجرّب الكود.

فيديو المحاضرة

فيديو المحاضرة

بعد الفيديو: الأمثلة والاختبار والتمارين والمشروع الصغير تحت.

رسوم متحركة

الـ tensors: scalar و vector و matrix
الـ neuron: المدخلات × الأوزان ← مجموع ← sigmoid
التعلّم: خطوات gradient descent لتحت

أمثلة Python

أمثلة قصيرة وبسيطة

الكود قصير والنتيجة اتجرّبت فعلاً. عدّل في المحرر واضغط شغّل.

المثال ١: Neuron بإيدينا

Sample output (press Run to produce your own):
weighted sum z: 0.5
neuron output : 0.622

المثال ٢: Tensors و shapes و broadcasting

Sample output (press Run to produce your own):
shapes: () (4,) (2, 3)
column means: [ 2. 20.]
centered:
[[ -1. -10.]
 [  0.   0.]
 [  1.  10.]]
X @ W shape: (3, 4)

المثال ٣: neuron بيتعلّم AND

Sample output (press Run to produce your own):
step 0 loss 0.693
step 100 loss 0.143
step 200 loss 0.081
step 300 loss 0.056
step 400 loss 0.043
step 500 loss 0.035
predictions: [0.   0.04 0.04 0.94]

افتح الفصل المقابل في كتاب d2l.ai

اختبار قصير

اختبر فهمك

1. What does a single artificial neuron compute?

2. A tensor with shape (32, 8) most naturally means:

3. What does the loss function tell us?

4. What does gradient descent do in each step?

5. For a small table with a few numeric columns, a good first move is:

تمارين برمجة

جرّب بإيدك

التمرين 1

احسب خرج neuron: المجموع الموزون z وبعدين الـ sigmoid، واطبع الاتنين.

Compute a neuron: the weighted sum z, then the sigmoid. Print both.

(output appears here)

التمرين 2

اعمل standardization لكل عمود (اطرح المتوسط واقسم على الانحراف) واطبع الناتج ومتوسطات الأعمدة الجديدة.

Standardize each column (subtract the mean, divide by the std). Print the result and the new column means.

(output appears here)

مشروع صغير في آخر المحاضرة

درّب neuron واحد يشخّص أورام الثدي

الداتا: Breast Cancer Wisconsin (Diagnostic): 569 samples, 30 numeric features, benign or malignant. Source: UCI Machine Learning Repository.

License / source: Ships with scikit-learn. Dataset page

الخطوات

  1. حمّل الداتا وقسّمها ٨٠/٢٠ بـ random_state=0 و stratify.
  2. اعمل standardization للـ features (احسب المتوسط والانحراف من الـ training بس).
  3. اكتب neuron واحد (وزن لكل feature + bias) بالـ sigmoid بإيدك بـ numpy.
  4. درّبه ٣٠٠ خطوة gradient descent بـ lr=0.5 على الـ cross-entropy.
  5. اطبع دقة الـ test وقارنها بـ LogisticRegression من scikit-learn.
Expected output (press Run to produce your own):
our neuron test accuracy: 0.974
sklearn test accuracy   : 0.982

Credits: the topic order follows the book "Dive into Deep Learning" (d2l.ai) by Zhang, Lipton, Li and Smola, whose text is licensed CC BY-SA 4.0. The explanations, diagrams and code in this lecture are our own and are not copied from the book. Reference: d2l.ai, Introduction.