Chapterبەش 8 · Lectureوانە 8.2

Neural Networks and Deep Learningتۆڕە دەمارییەکان و فێربوونی قووڵ

How an artificial neuron computes (weights, bias, ReLU and sigmoid), layers and why "deep", the forward pass, the loss, gradient descent with a learning rate, backpropagation, epochs and early stopping, why XOR needs a hidden layer (a 2-2-1 network trained in plain Python), convolutional networks for pictures, a network that found planets, RNNs and transformers, the bridge to generative AI, and why deep learning took off in 2012 (ImageNet, AlexNet, GPUs) up to the 2024 Nobel Prize.

چۆن حیساب دەکات (، ، و )، و بۆچی «قووڵ»، ، زیان، بە ، ، و ڕاگرتنی زوو، بۆچی XOR پێویستی بە هەیە (تۆڕێکی ⁦2-2-1⁩ کە بە Pythonـی سادە ڕاهێنراوە)، بۆ وێنە، تۆڕێک کە هەسارەی دۆزییەوە، و ، پردی و بۆچی لە ⁦2012⁩دا هەستایەوە (ImageNet، AlexNet، ) تا خەڵاتی نۆبڵی ⁦2024⁩.

29 min read30 خولەک خوێندنەوە · 24 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Compute the output of an artificial neuron from its inputs, weights, bias and activation function (ReLU, sigmoid).
  • Describe the input, hidden and output layers, count a network's weights and biases, and explain what "deep" means.
  • Explain the training loop: forward pass, loss, backpropagation and gradient descent with a learning rate, epochs and early stopping.
  • Run and read a small neural network in plain Python that learns XOR, and explain why XOR needs a hidden layer.
  • Explain how a CNN uses filters and pooling on pictures, and what RNNs and transformers do with sequences.
  • Explain why deep learning took off after 2010 (big data, GPUs, better methods) and name its milestones up to the 2024 Nobel Prize.
  • لە ، ، و (، ) حیساب بکەیت.
  • ، و باس بکەیت، و تۆڕێک بژمێریت و ڕوونی بکەیتەوە «قووڵ» واتای چییە.
  • ڕاهێنان ڕوون بکەیتەوە: ، زیان، و بە ، و ڕاگرتنی زوو.
  • تۆڕێکی دەماریی بچووک بە Pythonـی سادە کە XOR فێر دەبێت کار پێ بکەیت و بیخوێنیتەوە و ڕوونی بکەیتەوە بۆچی XOR پێویستی بە هەیە.
  • ڕوونی بکەیتەوە چۆن و لەسەر وێنە بەکار دەهێنێت و و چی لە زنجیرەدا دەکەن.
  • ڕوونی بکەیتەوە بۆچی دوای ⁦2010⁩ هەستایەوە (، ، ڕێگای باشتر) و قۆناغە گرنگەکانی تا خەڵاتی نۆبڵی ⁦2024⁩ ناو ببەیت.

From one neuron to deep learningلە یەک دەمارەخانەی دەستکردەوە تا فێربوونی قووڵ

In Machine Learning Basics a model learned a rule from examples. Most of today's AI, from voice typing and photo search to chatbots, is built from one kind of model: the neural network. When a network has many layers, learning with it is called deep learning.

لە بنەماکانی فێربوونی ئامێردا یاسایەکی لە نموونەکانەوە فێر بوو. زۆربەی ئەمڕۆ، لە نووسین بە دەنگ و گەڕان لە وێنەکانەوە تا ، لە یەک جۆر دروست کراوە: . کاتێک تۆڕێک چەندین هەبێت، فێربوون پێی پێی دەگوترێت .

This lesson builds the idea from the bottom up: one artificial neuron, then layers, then how a network learns from its own mistakes. You will train a small network in Python, see how networks read pictures, and learn why deep learning suddenly worked after 2012.

ئەم وانەیە بیرۆکەکە لە خوارەوە بۆ سەرەوە بنیات دەنێت: یەک ، پاشان ، پاشان تۆڕێک چۆن لە هەڵەکانی خۆیەوە فێر دەبێت. تۆڕێکی بچووک بە Python ڕادەهێنیت، دەبینیت تۆڕەکان چۆن وێنە دەخوێننەوە و تێدەگەیت بۆچی لە دوای ⁦2012⁩ لەناکاو سەرکەوت.

Four nested boxes. The outer box is artificial intelligence (search, logic, games and agents: the earlier lessons of this course). Inside it is machine learning, which learns from examples instead of hand-written rules. Inside that are neural networks, layers of artificial neurons. In the middle is deep learning: networks with many hidden layers, used for speech, pictures, translation and chatbots. Generative AI is built on deep learning.چوار سندووق لە ناو یەکتردا. سندووقی دەرەوە ژیریی دەستکردە (گەڕان، لۆجیک، یاری و ئەیجێنتەکان: وانەکانی پێشووی ئەم کۆرسە). لە ناویدا فێربوونی ئامێر هەیە کە لە نموونەکانەوە فێر دەبێت، نەک لە یاسای دەستنووس. لە ناو ئەویشدا تۆڕە دەمارییەکان، چینەکانی دەمارەخانە دەستکردەکان. لە ناوەڕاستدا فێربوونی قووڵ: تۆڕ بە چەندین چینی شاراوە، بۆ دەنگ، وێنە، وەرگێڕان و چاتبۆتەکان. ژیریی دەستکردی بەرهەمهێنەر لەسەر فێربوونی قووڵ دروست کراوە.
Deep learning is a part of machine learning, which is a part of AI. بەشێکە لە ، کە خۆی بەشێکە لە .CêIT
AI, Machine Learning, Deep Learning and Generative AI ExplainedIBM Technology · Englishئینگلیزی · 3.7M viewsبینین · 79K likesلایک · Partبەشی 4:48–9:08 (ofلە 10:00)

How AI, machine learning, deep learning and generative AI fit inside each other, and how each one grew in time.

چۆن ، ، و یەک لەناو یەکدان و هەر یەکەیان بە درێژایی کات چۆن گەشەی کردووە.

Plays 4:48–9:08: deep learning (neural networks), foundation models, large language models as a kind of autocomplete, generative AI for text, audio and video, and deepfakes.

لە ⁦4:48⁩ تا ⁦9:08⁩ لێدەدرێت: ()، ، وەک جۆرێک لە تەواوکەری خۆکار، بۆ دەق و دەنگ و ڤیدیۆ، هەروەها ڤیدیۆ و دەنگی ساختە (deepfakes).

The artificial neuronدەمارەخانەی دەستکرد

An artificial neuron is a tiny calculator. It takes a few numbers (its inputs), multiplies each one by a weight that says how important it is, adds them up, and adds one more number, the bias. Then an activation function turns the sum into the neuron's output. The idea is loosely inspired by brain cells, but it is simple arithmetic.

بچووکە. چەند ژمارەیەک وەردەگرێت ()، هەریەکەیان لە دەدات کە دەڵێت چەند گرنگە، هەموویان کۆ دەکاتەوە و ژمارەیەکی تریش زیاد دەکات: . پاشان کۆکە دەکاتە . بیرۆکەکە کەمێک لە خانەکانی مێشکەوە وەرگیراوە، بەڵام تەنیا حیسابێکی سادەیە.

A fruit seller at the bazaarمیوەفرۆشێک لە بازاڕ

Kak Rebin sells pomegranates. He judges a fruit by its redness and its weight in his hand. Redness counts more for him (a bigger weight), and he only calls a fruit ripe when the evidence is strong (a negative bias, like a high bar to jump). That is one neuron.

کاک ڕێبین هەنار دەفرۆشێت. هەنارێک بە سووری و قورسییەکەی لە دەستیدا هەڵدەسەنگێنێت. سووری لای ئەو گرنگترە ( گەورەتر) و تەنیا کاتێک دەڵێت هەنارەکە پێگەیشتووە کە بەڵگەکان بەهێز بن ( نەرێنی، وەک بەربەستێکی بەرز). ئەمە یەک .

Where the analogy stops workingسنووری ئەم نموونەیە

A real neuron learns its weights from thousands of examples; Kak Rebin learned his from years at the bazaar.

لە تۆڕێکی ڕاستەقینەدا لە هەزاران نموونەوە فێر دەبن؛ کاک ڕێبین هی خۆی لە ساڵانی کارکردن لە بازاڕەوە فێر بوو.

z=w1x1+w2x2+boutput=f(z)z = w_1 x_1 + w_2 x_2 + b \qquad \text{output} = f(z)

The weighted sum z, then the activation function f.

کۆی قورسکراو z، پاشان f.

One neuron with numbers. Inputs: redness x1 = 0.9 and heaviness x2 = 0.8. Weights w1 = 3 and w2 = 2 on the arrows. Bias b = −3.5 goes into a circle with Σ. The sum is z = 3 × 0.9 + 2 × 0.8 − 3.5 = 0.8. The activation function, a sigmoid, gives σ(0.8) = 0.69, so the output 0.69 means probably ripe.یەک دەمارەخانەی دەستکرد بە ژمارەوە. نێوخستەکان: سووری x1 = 0.9 و قورسی x2 = 0.8. کێشەکان w1 = 3 و w2 = 2 لەسەر تیرەکان. بایەس b = −3.5 دەچێتە ناو بازنەیەکی Σ. کۆکە z = 3 × 0.9 + 2 × 0.8 − 3.5 = 0.8ـە. کرداری چالاککردن، کە کرداری سیگمۆیدە، σ(0.8) = 0.69 دەدات، بۆیە دەرخستەی 0.69 واتە ئەگەری زۆرە پێگەیشتبێت.
One neuron: weights times inputs, plus the bias, then an activation function.یەک : جاران ، لەگەڵ ، پاشان .CêIT

The artificial neuronدەمارەخانەی دەستکرد

Activation functions: ReLU and sigmoidکردارەکانی چالاککردن: ReLU و کرداری سیگمۆید

Why not pass the sum on as it is? Because sums of sums are still one straight line: a hundred layers without activation functions can do no more than one linear classifier. The activation function bends the line, and that lets layers build curved, complex shapes. Three are worth knowing:

بۆچی کۆکە وەک خۆی نانێرین؟ چونکە کۆی کۆکان هێشتا یەک هێڵی ڕاستە: سەد بەبێ لە یەک پۆلێنکەری هێڵی زیاتر ناکەن. هێڵەکە دەچەمێنێتەوە و ئەمە ڕێگە بە دەدات شێوەی چەماوە و ئاڵۆز دروست بکەن. سێیان شایەنی ناسینن:

  • Step function: 0 or 1, yes or no. Rosenblatt's perceptron (1958) used it. It cannot be trained with gradient descent, because its slope is 0 almost everywhere.
  • Sigmoid: σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}} squeezes any number between 0 and 1, so it suits a yes/no probability in the output layer.
  • ReLU: max⁡(0,z)\max(0, z) keeps positive numbers and turns negative ones into 0. It is cheap to compute and trains well, so it is the usual choice in hidden layers today.
  • : 0 یان 1، بەڵێ یان نەخێر. ـی ⁦Rosenblatt (1958)⁩ بەکاری دەهێنا. ناتوانرێت بە ڕابهێنرێت، چونکە لە زۆربەی شوێنەکاندا 0ـە.
  • : σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}} هەر ژمارەیەک دەگوشێتە نێوان 0 و 1، بۆیە بۆ بەڵێ/نەخێر لە دەگونجێت.
  • : max⁡(0,z)\max(0, z) ژمارەی ئەرێنی دەهێڵێتەوە و ژمارەی نەرێنی دەکاتە 0. حیسابکردنی هەرزانە و باش ڕادەهێنرێت، بۆیە ئەمڕۆ هەڵبژاردەی ئاسایییە لە .
Three graphs of z from −4 to 4. Step function (the perceptron): 0 for negative z and 1 from z = 0, only yes or no. Sigmoid, 1 / (1 + e^(−z)): an S-shaped curve from almost 0 to almost 1. ReLU, max(0, z): flat at 0 for negative z, then a straight line going up; the most used today.سێ گراف بۆ z لە −4 تا 4. نەخشەی پلەدار (پێرسێپترۆن): 0 بۆ z ـی نەرێنی و 1 لە z = 0ـەوە، تەنیا بەڵێ یان نەخێر. کرداری سیگمۆید، 1 / (1 + e^(−z)): چەماوەیەکی وەک S لە نزیکەی 0 تا نزیکەی 1. ReLU، max(0, z): بۆ z ـی نەرێنی لەسەر 0 تەختە، پاشان هێڵێکی ڕاست کە بەرز دەبێتەوە؛ باوترینە لە ئەمڕۆدا.
Three activation functions: step, sigmoid and ReLU.سێ : ، و .CêIT

The artificial neuronدەمارەخانەی دەستکرد

One neuron in Pythonیەک دەمارەخانەی دەستکرد بە Python

Here is Kak Rebin's neuron as a small Python program. It needs nothing but the math module (functions and zip are all you need). It checks two pomegranates, one red and heavy, one pale and light:

ئەمە کاک ڕێبینە وەک بچووکی Python. جگە لە math هیچی تری ناوێت (کردارەکان و zip بەسن). دوو هەنار دەپشکنێت، یەکێکیان سوور و قورس، ئەوی تر کاڵ و سووک:

One neuron: weighted sum, bias and two activation functionsیەک دەمارەخانەی دەستکرد: کۆی قورسکراو، بایەس و دوو کرداری چالاککردنneuron.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import math

def sigmoid(z):
    return 1 / (1 + math.exp(-z))

def relu(z):
    return max(0.0, z)

def neuron(inputs, weights, bias):
    z = sum(x * w for x, w in zip(inputs, weights)) + bias
    return z

# A pomegranate: [redness, heaviness], each from 0 to 1
weights = [3.0, 2.0]
bias = -3.5

for fruit in ([0.9, 0.8], [0.3, 0.4]):
    z = neuron(fruit, weights, bias)
    print(f"{fruit}: z = {z:.2f}, sigmoid = {sigmoid(z):.3f}, ReLU = {relu(z):.2f}")
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 10

zip pairs each input with its weight; sum adds the products; then the bias is added.

zip هەر لەگەڵ جووت دەکات؛ sum لێکدانەکان کۆ دەکاتەوە؛ پاشان زیاد دەکرێت.

Lineدێڕی 14-15

These numbers are chosen by hand here. In a real network, training finds them.

ئەم ژمارانە لێرەدا بە دەست هەڵبژێردراون. لە تۆڕێکی ڕاستەقینەدا ڕاهێنان دەیاندۆزێتەوە.

The red, heavy fruit gets 0.69 ("probably ripe"); the pale one gets 0.142. Notice what the bias does: with −3.5, the inputs must be strong before z becomes positive. In 1958 a neuron like this was a whole machine, Rosenblatt's Mark I Perceptron; today it is a few lines of code.

میوە سوور و قورسەکە ⁦0.69⁩ وەردەگرێت («ئەگەری زۆرە پێگەیشتبێت»)؛ کاڵەکە ⁦0.142⁩. سەرنج بدە چی دەکات: بە ⁦−3.5⁩، دەبێت بەهێز بن پێش ئەوەی z ئەرێنی ببێت. لە ⁦1958⁩دا وەک ئەمە ئامێرێکی تەواو بوو، Mark I Perceptronـی Rosenblatt؛ ئەمڕۆ چەند دێڕێکی کۆدە.

Layers: input, hidden and outputچینەکان: نێوخستە، شاراوە و دەرخستە

One neuron can only draw one straight line. Put many neurons side by side and you get a layer; put layers one after another and you get a network. Every network has three kinds of layer:

یەک تەنیا دەتوانێت یەک هێڵی ڕاست بکێشێت. چەندین لە تەنیشت یەکتر دابنێ و دروست دەبێت؛ لە دوای یەکتر دابنێ و تۆڕێک دروست دەبێت. هەموو تۆڕێک سێ جۆر هەیە:

  • The input layer only holds the numbers that go in (here: hours of study, hours of sleep, classes attended). It calculates nothing.
  • Hidden layers sit in the middle. Each neuron gets every output of the layer before ("fully connected") and finds a pattern in them. Nobody tells them which pattern: training decides.
  • The output layer gives the answer: one neuron for a yes/no question, or one neuron per class.
  • تەنیا ئەو ژمارانە هەڵدەگرێت کە دەچنە ژوورەوە (لێرەدا: کاتژمێری خوێندن، کاتژمێری خەو، ئامادەبوون لە وانەکان). هیچ حیسابێک ناکات.
  • لە ناوەڕاستدان. هەر هەموو پێشوو وەردەگرێت («تەواو بەستراو») و شێوازێک تێیاندا دەدۆزێتەوە. کەس پێیان ناڵێت کام شێواز: ڕاهێنان بڕیار دەدات.
  • وەڵامەکە دەدات: یەک بۆ پرسیارێکی بەڵێ/نەخێر، یان یەک بۆ هەر پۆلێک.
A network that predicts whether a student passes. Input layer: three circles for hours of study, hours of sleep and classes attended; no calculation. Hidden layer: four neurons, each joined to all three inputs: 3 × 4 weights + 4 biases = 16 numbers. Output layer: one neuron joined to all four hidden neurons, 4 weights + 1 bias = 5, giving pass? 0.83. In total 21 numbers for training to learn.تۆڕێک کە پێشبینی دەکات خوێندکارێک دەردەچێت یان نا. چینی نێوخستە: سێ بازنە بۆ کاتژمێری خوێندن، کاتژمێری خەو و ئامادەبوون لە وانەکان؛ هیچ حیساب ناکات. چینی شاراوە: چوار دەمارەخانەی دەستکرد، هەریەکە بە هەر سێ نێوخستەکە بەستراوە: 3 × 4 کێش + 4 بایەس = 16 ژمارە. چینی دەرخستە: یەک دەمارەخانەی دەستکرد بە هەر چوار دەمارەخانەی دەستکردەکەی چینی شاراوەکە بەستراوە، 4 کێش + 1 بایەس = 5 و «دەردەچێت؟ 0.83» دەدات. بە گشتی 21 ژمارە کە ڕاهێنان فێریان دەبێت.
A small network: 3 inputs, 4 hidden neurons and 1 output, with 21 weights and biases to learn.تۆڕێکی بچووک: 3 ، 4 شاراوە و 1 ، بە ⁦21⁩ و بۆ فێربوون.CêIT

Layers: input, hidden and outputچینەکان: نێوخستە، شاراوە و دەرخستە

Why deep? From pixels to "cat"بۆچی قووڵ؟ لە پیکسڵەکانەوە تا «پشیلە»

Deep simply means many layers. Google's glossary calls a network with more than one hidden layer a deep neural network; large modern models have dozens or even hundreds. Depth helps because each layer can build on the patterns found by the layer before. Take a network that decides whether a photo shows a cat:

قووڵ تەنیا واتە چەندین . فەرهەنگۆکی Google تۆڕێک کە زیاتر لە یەک هەبێت ناو دەنێت قووڵ؛ گەورەترین ئەمڕۆ دەیان یان تەنانەت سەدان هەیە. قووڵی یارمەتی دەدات، چونکە هەر دەتوانێت لەسەر ئەو شێوازانە بنیات بنێت کە پێشوو دۆزیونیەوە. تۆڕێک وەربگرە کە بڕیار دەدات ئایا وێنەیەک پشیلەی تێدایە:

  • Input layer: the photo is cut into pixels; each pixel is a number for its colour or brightness (a picture is a grid of numbers).
  • Hidden layers: the first one reacts to simple features such as edges and corners; the next ones combine them into shapes and textures (ears, eyes, fur), and later ones into a whole cat face.
  • Output layer: here two neurons, cat and not cat. The bigger score wins: 0.9 for cat means "very likely a cat".
  • : وێنەکە دەکرێت بە ؛ هەر ژمارەیەکە بۆ ڕەنگ یان ڕووناکییەکەی (وێنە تۆڕێکی ژمارەیە).
  • : یەکەمیان بە تایبەتمەندیی سادە وەک لێوار و گۆشە دەجووڵێت؛ ئەوانەی دواتر ئەمانە دەکەن بە شێوە و ڕووکار (گوێ، چاو، موو) و ئەوانەی دواتریش بە ڕووخسارێکی تەواوی پشیلە.
  • : لێرەدا دوو ، پشیلە و پشیلە نییە. نمرەی گەورەتر دەباتەوە: ⁦0.9⁩ بۆ پشیلە واتە «زۆر ئەگەری هەیە پشیلە بێت».
A neural network drawn from left to right. A photo is cut into pixels and goes into the input layer (5 neurons). Two hidden layers follow: the first reacts to edges and corners, the second to ears, eyes and fur. Every neuron is connected to every neuron of the next layer. The output layer has two neurons: cat 0.9 and not cat 0.1. A small box shows one neuron: w1·x1 + w2·x2 + … + b, weights times inputs plus a bias, then a simple function. A dashed arrow goes back from the output to the input: training compares the answer with the label, then backpropagation changes the weights.تۆڕی دەماری لە چەپەوە بۆ ڕاست کێشراوە. وێنەیەک دەکرێت بە پیکسڵەکان و دەچێتە ناو چینی نێوخستەوە (5 دەمارەخانەی دەستکرد). دوو چینی شاراوە دێن: یەکەمیان بە لێوار و گۆشە دەجووڵێت، دووەمیان بە گوێ، چاو و موو. هەر دەمارەخانەیەکی دەستکرد بە هەموو دەمارەخانە دەستکردەکانی چینەکەی دواترەوە بەستراوە. چینی دەرخستە دوو دەمارەخانەی دەستکردی هەیە: پشیلە 0.9 و پشیلە نییە 0.1. چوارچێوەیەکی بچووک دەمارەخانەیەکی دەستکرد پیشان دەدات: w1·x1 + w2·x2 + … + b، کێشەکان جاران نێوخستەکان لەگەڵ بایەس، پاشان کرداری چالاککردن. تیرێکی پچڕپچڕ لە دەرخستەوە بۆ نێوخستە دەگەڕێتەوە: ڕاهێنان وەڵامەکە لەگەڵ نیشانە بەراورد دەکات، پاشان گەڕاندنەوەی هەڵە بۆ دواوە کێشەکان دەگۆڕێت.
A small neural network that recognises cats, and one of its neurons. کە بچووکە و پشیلە دەناسێتەوە، لەگەڵ یەکێک لە .CêIT

Layers: input, hidden and outputچینەکان: نێوخستە، شاراوە و دەرخستە

The forward pass: from input to answerتێپەڕینی بەرەوپێش: لە نێوخستەوە تا وەڵام

To get an answer, the network runs a forward pass: the input layer hands its numbers to the first hidden layer, every neuron there computes its output, those outputs go to the next layer, and so on until the output layer. The picture shows the small network you will train later in this lesson, after training, with the input (1, 0):

بۆ وەرگرتنی وەڵام، تۆڕەکە ئەنجام دەدات: ژمارەکانی دەداتە یەکەم ، هەر لەوێ خۆی حیساب دەکات، ئەو دەچنە دواتر و بەم شێوەیە تا . وێنەکە ئەو تۆڕە بچووکە پیشان دەدات کە دواتر لەم وانەیەدا ڕای دەهێنیت، دوای ڕاهێنان، بە ⁦(1, 0)⁩:

A trained network with two inputs, two hidden neurons and one output, for the input x1 = 1, x2 = 0. The weights on the arrows are −6.4, 6.3, 6.0 and −6.2 into the hidden layer and 10.1 and 10.2 into the output. The first hidden neuron gives 0.000 (it fires only for x2 alone, bias −3.5); the second gives 0.936 (it fires only for x1 alone, bias −3.3). The output neuron, bias −5.0, fires for either one and gives 0.989, about 1. An arrow at the bottom: forward pass, layer by layer, from left to right.تۆڕێکی ڕاهێنراو بە دوو نێوخستە، دوو دەمارەخانەی دەستکردی شاراوە و یەک دەرخستە، بۆ نێوخستەی x1 = 1، x2 = 0. کێشەکان لەسەر تیرەکان −6.4، 6.3، 6.0 و −6.2ن بەرەو چینی شاراوە و 10.1 و 10.2 بەرەو دەرخستە. یەکەم دەمارەخانەی دەستکردی شاراوە 0.000 دەدات (تەنیا بۆ x2 بە تەنیا چالاک دەبێت، بایەس −3.5)؛ دووەمیان 0.936 دەدات (تەنیا بۆ x1 بە تەنیا چالاک دەبێت، بایەس −3.3). دەمارەخانەی دەستکردی دەرخستە، بە بایەس −5.0، بۆ هەر یەکێکیان چالاک دەبێت و 0.989 دەدات، نزیکەی 1. تیرێک لە خوارەوە: تێپەڕینی بەرەوپێش، چین بە چین، لە چەپەوە بۆ ڕاست.
A forward pass through a trained XOR network: 1 and 0 go in, 0.989 comes out. بە ناو تۆڕێکی XORـی ڕاهێنراودا: 1 و 0 دەچنە ژوورەوە، ⁦0.989⁩ دێتە دەرەوە.CêIT

The second hidden neuron, for example, computes σ(6.0×1−6.2×0−3.3)=σ(2.7)≈0.936\sigma(6.0 \times 1 - 6.2 \times 0 - 3.3) = \sigma(2.7) \approx 0.936. Each layer is really one big table of multiplications and additions (a matrix product), which is exactly the work a graphics processor (GPU) does fast.

بۆ نموونە، دووەم شاراوە ئەمە حیساب دەکات: σ(6.0×1−6.2×0−3.3)=σ(2.7)≈0.936\sigma(6.0 \times 1 - 6.2 \times 0 - 3.3) = \sigma(2.7) \approx 0.936. هەر لە ڕاستیدا یەک خشتەی گەورەی لێکدان و کۆکردنەوەیە (لێکدانی ماتریکس)، کە ڕێک ئەو کارەیە کە بە خێرایی دەیکات.

How wrong is it? The loss functionچەند هەڵەیە؟ کرداری زیان

A new network starts with random weights, so its answers are guesses. To improve, it first needs a number that says how wrong it is. That number comes from a loss function. A common one is the mean squared error: for each example take the difference between the right answer y and the network's answer y^\hat{y}, square it, and average over all examples.

تۆڕێکی نوێ بە هەڕەمەکی دەست پێ دەکات، بۆیە وەڵامەکانی مەزەندەن. بۆ باشتربوون، سەرەتا پێویستی بە ژمارەیەکە کە بڵێت چەند هەڵەیە. ئەو ژمارەیە لە دێت. یەکێکی باو ناوەندی دووجای هەڵەیە: بۆ هەر نموونەیەک جیاوازیی نێوان وەڵامی ڕاست y و وەڵامی تۆڕەکە y^\hat{y} وەربگرە، دووجای بکە و ناوەندی هەموو نموونەکان بدۆزەوە.

L=1n∑i=1n(yi−y^i)2L = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2

Example: the right answer is 1 and the network says 0.7, so this example adds (1 − 0.7)² = 0.09.

نموونە: وەڵامی ڕاست 1ـە و تۆڕەکە دەڵێت ⁦0.7⁩، بۆیە ئەم نموونەیە ⁦(1 − 0.7)² = 0.09⁩ زیاد دەکات.

Training means one thing: change the weights and biases so that the loss gets smaller. The curve shows this happening in the Python program of this lesson.

ڕاهێنان یەک واتای هەیە: و بگۆڕە بۆ ئەوەی زیانەکە بچووکتر ببێتەوە. چەماوەکە پیشان دەدات ئەمە چۆن لە Pythonـی ئەم وانەیەدا ڕوو دەدات.

A line chart of the loss (y-axis, 0 to 0.3) against epochs (x-axis, 0 to 3,000) for the XOR network of this lesson. At epoch 0 the loss is 0.275: the network is still guessing. Between epochs 300 and 500 it drops steeply: the network finds the idea. Then it flattens close to 0 and is 0.0006 at epoch 2,900.گرافێکی هێڵی بۆ زیان (تەوەرەی ستوونی، 0 تا 0.3) بەرامبەر گەڕی ڕاهێنان (تەوەرەی ئاسۆیی، 0 تا 3,000) بۆ تۆڕی XORـی ئەم وانەیە. لە گەڕی ڕاهێنان 0دا زیانەکە 0.275ـە: تۆڕەکە هێشتا مەزەندە دەکات. لە نێوان گەڕی ڕاهێنان 300 و 500دا بە تیژی دادەبەزێت: تۆڕەکە بیرۆکەکە دەدۆزێتەوە. پاشان نزیک 0 تەخت دەبێتەوە و لە گەڕی ڕاهێنان 2,900دا 0.0006ـە.
The loss of the XOR network falls as it trains (real numbers from xor.py).زیانی تۆڕی XOR لە کاتی ڕاهێناندا کەم دەبێتەوە (ژمارەی ڕاستەقینە لە ⁦xor.py⁩).CêIT

How wrong is it? The loss functionچەند هەڵەیە؟ کرداری زیان

Gradient descent: walking downhillدابەزینی گرادیەنت: ڕۆیشتن بەرەو خوارەوەی لێژی

Coming down Korek mountain in fogدابەزین لە چیای کۆڕەک لە ناو تەمدا

Dilan is on Korek mountain in thick fog and wants to reach the valley. She cannot see far, but she can feel which way the ground slopes under her feet. So she takes a small step downhill, feels again, and steps again. That is gradient descent: the height is the loss, and her position is the weights.

دیلان لە چیای کۆڕەکە لە ناو تەمێکی چڕدا و دەیەوێت بگاتە دۆڵەکە. ناتوانێت دوور ببینێت، بەڵام هەست دەکات زەوی لە ژێر پێیدا بەرەو کوێ لێژە. بۆیە هەنگاوێکی بچووک بەرەو خوار دەنێت، دیسان هەست دەکات و دیسان هەنگاو دەنێت. ئەمە : بەرزی زیانەکەیە و شوێنەکەی ئەویش .

Where the analogy stops workingسنووری ئەم نموونەیە

A real network has millions of weights, so it walks in a landscape with millions of directions, not two.

تۆڕێکی ڕاستەقینە ملیۆنان هەیە، بۆیە لە دیمەنێکدا دەڕوات کە ملیۆنان ئاڕاستەی هەیە، نەک دوو.

The slope of the loss for one weight (its derivative) says which way is uphill. Gradient descent moves the weight a small step the other way. The size of the step is set by the learning rate η. This is hill climbing turned upside down: we want the lowest point.

زیان بۆ یەک (مشتەقەکەی) دەڵێت کام لا بەرەو سەرەوەیە. هەنگاوێکی بچووک بەرەو لای پێچەوانە دەجووڵێنێت. قەبارەی هەنگاوەکە بە η دیاری دەکرێت. ئەمە چیاهەڵەگڕیـە بە پێچەوانەوە: نزمترین خاڵمان دەوێت.

wnew=w−η⋅∂L∂ww_{\text{new}} = w - \eta \cdot \frac{\partial L}{\partial w}

Worked example: one weight, loss (2w − 6)², start w = 1, η = 0.1. The slope is 8w − 24 = −16, so w = 1 − 0.1 × (−16) = 2.6.

نموونەی چارەسەرکراو: یەک ، زیانی ⁦(2w − 6)²⁩، دەستپێک ⁦w = 1⁩، ⁦η = 0.1⁩. ⁦8w − 24 = −16⁩ـە، بۆیە ⁦w = 1 − 0.1 × (−16) = 2.6⁩.

Animation. A U-shaped curve of the loss (2w − 6)² for w from 0 to 5. A ball starts at w = 1 with loss 16; a dashed tangent shows the slope −16, so downhill is to the right. Step 1 jumps to w = 2.6 (loss 0.64), step 2 to w = 2.92 (loss 0.026), step 3 to w = 2.984 (loss 0.001). A table on the right fills up row by row. Last frame: near the bottom the slope is almost 0, so the steps get small by themselves; the best w is 3.
Animation. A U-shaped curve of the loss (2w − 6)² for w from 0 to 5. A ball starts at w = 1 with loss 16; a dashed tangent shows the slope −16, so downhill is to the right. Step 1 jumps to w = 2.6 (loss 0.64), step 2 to w = 2.92 (loss 0.026), step 3 to w = 2.984 (loss 0.001). A table on the right fills up row by row. Last frame: near the bottom the slope is almost 0, so the steps get small by themselves; the best w is 3.
Gradient descent with learning rate 0.1: three steps from w = 1 to almost 3. بە ⁦0.1⁩: سێ هەنگاو لە ⁦w = 1⁩ـەوە تا نزیکەی 3.CêIT

How wrong is it? The loss functionچەند هەڵەیە؟ کرداری زیان

The learning rate: how big is each step?ڕێژەی فێربوون: هەر هەنگاوێک چەند گەورەیە؟

The learning rate is chosen by people before training (a hyperparameter, like the number of layers or epochs). The same example, run with three learning rates, shows why the choice matters:

پێش ڕاهێنان لەلایەن مرۆڤەوە هەڵدەبژێردرێت (وەک ژمارەی یان ، ڕێکخستنێکە کە تۆڕەکە خۆی فێری نابێت). هەمان نموونە، بە سێ ، پیشان دەدات بۆچی ئەم هەڵبژاردنە گرنگە:

Three copies of the same U-shaped loss curve, each starting at w = 1. Too small, 0.02: tiny steps 1, 1.32, 1.59, 1.82, 2.00, still far from the bottom after 4 steps. Good, 0.1: 1, 2.6, 2.92, 2.98, reaching the bottom at w = 3 in 3 steps. Too big, 0.3: 1, 5.8, −0.92, then 8.5 and −4.7: it jumps over the bottom and the loss grows.سێ وێنەی هەمان چەماوەی زیانی وەک U، هەریەکە لە w = 1ـەوە دەست پێ دەکات. زۆر بچووک، 0.02: هەنگاوی بچکۆلە 1، 1.32، 1.59، 1.82، 2.00، دوای 4 هەنگاو هێشتا لە نشێوەکە دوورە. باش، 0.1: 1، 2.6، 2.92، 2.98، لە 3 هەنگاودا دەگاتە نشێوەکە لە w = 3. زۆر گەورە، 0.3: 1، 5.8، −0.92، پاشان 8.5 و −4.7: بەسەر نشێوەکەدا باز دەدات و زیانەکە گەورە دەبێت.
Too small is slow, too big jumps over the bottom (real numbers, loss = (2w − 6)²).زۆر بچووک خاوە، زۆر گەورە بەسەر نشێوەکەدا باز دەدات (ژمارەی ڕاستەقینە، زیان = ⁦(2w − 6)²⁩).CêIT

With 0.3 the loss goes 16, 31.4, 61.5, 120.5: training diverges. In real projects people try a few values (0.1, 0.01, 0.001…) and watch the loss curve.

بە ⁦0.3⁩ زیانەکە دەبێتە ⁦16⁩، ⁦31.4⁩، ⁦61.5⁩، ⁦120.5⁩: ڕاهێنان لێک دەترازێت. لە پڕۆژەی ڕاستەقینەدا خەڵک چەند بەهایەک تاقی دەکەنەوە (⁦0.1⁩، ⁦0.01⁩، ⁦0.001⁩…) و سەیری چەماوەی زیان دەکەن.

How wrong is it? The loss functionچەند هەڵەیە؟ کرداری زیان

Backpropagation: sharing out the blameگەڕاندنەوەی هەڵە بۆ دواوە: دابەشکردنی تاوان

A network has thousands or millions of weights. Which ones caused the error, and by how much? Backpropagation answers this. After the forward pass and the loss, it goes backwards from the output layer to the first hidden layer and, with the chain rule of calculus, works out the slope of the loss for every weight. Then gradient descent changes every weight a little. The method was made popular by Rumelhart, Hinton and Williams in 1986.

تۆڕێک هەزاران یان ملیۆنان هەیە. کامیان بوونە هۆی هەڵەکە و چەند؟ وەڵامی ئەمە دەداتەوە. دوای و زیان، لە بۆ دواوە دەگەڕێتەوە تا یەکەم و بە یاسای زنجیرەی ژمێرکاری زیان بۆ هەموو حیساب دەکات. پاشان هەموو کەمێک دەگۆڕێت. ئەم ڕێگایە لە ⁦1986⁩دا لەلایەن Rumelhart، Hinton و Williamsـەوە بڵاو بووەوە.

After a goal is concededدوای ئەوەی گۆڵێک دەکرێت

When Soran's football team concedes a goal, the coach replays it backwards: the goalkeeper was a little late, but the defender before him was out of place, and the midfielder before that lost the ball. Each player gets his share of the blame and trains on it. Backpropagation shares out the error the same way, layer by layer, from the end back to the start.

کاتێک تیمی تۆپی پێی سۆران گۆڵێکی لێ دەکرێت، ڕاهێنەرەکە بە پێچەوانەوە سەیری دەکاتەوە: گۆڵپارێزەکە کەمێک دواکەوت، بەڵام بەرگریکارەکەی پێش ئەو لە شوێنی خۆیدا نەبوو و یاریزانی ناوەڕاستی پێش ئەویش تۆپەکەی لەدەست دا. هەر یاریزانێک بەشی خۆی لە تاوانەکە وەردەگرێت و لەسەری ڕاهێنان دەکات. بە هەمان شێوە هەڵەکە دابەش دەکات، بە ، لە کۆتاییەوە بۆ سەرەتا.

Where the analogy stops workingسنووری ئەم نموونەیە

The network does not judge; it computes exactly how much each weight changed the loss.

تۆڕەکە دادوەری ناکات؛ ڕێک حیساب دەکات هەر چەندی زیانەکەی گۆڕیوە.

A network with 2 inputs, 3 hidden neurons and 1 output. 1. Forward pass (blue arrow to the right): compute the answer. A box compares: answer 0.70, label 1, error 0.30. 2. Backpropagation (dashed orange arrow to the left): the error goes back and every weight gets its share of the blame. 3. Gradient descent: change every weight a little so the error gets smaller. Then the next example: forward, back, update.تۆڕێک بە 2 نێوخستە، 3 دەمارەخانەی دەستکردی شاراوە و 1 دەرخستە. 1. تێپەڕینی بەرەوپێش (تیری شین بەرەو ڕاست): وەڵامەکە حیساب دەکرێت. چوارچێوەیەک بەراورد دەکات: وەڵام 0.70، نیشانە 1، هەڵە 0.30. 2. گەڕاندنەوەی هەڵە بۆ دواوە (تیری پرتەقاڵیی پچڕپچڕ بەرەو چەپ): هەر کێشێک بەشی خۆی لە هەڵەکە وەردەگرێت. 3. دابەزینی گرادیەنت: هەموو کێشێک کەمێک دەگۆڕدرێت بۆ ئەوەی هەڵەکە بچووکتر ببێت. پاشان نموونەی دواتر: بۆ پێشەوە، بۆ دواوە، گۆڕین.
One training step: forward pass, backpropagation, then gradient descent.یەک هەنگاوی ڕاهێنان: ، ، پاشان .CêIT

At first the weights are random and the answers are poor. After many thousands of labelled photos, a network trained this way recognises cats it has never seen, much as a child learns pointed ears and whiskers from many examples.

لە سەرەتادا هەڕەمەکین و وەڵامەکان لاوازن. دوای هەزاران وێنەی نیشانەکراو، تۆڕێک کە بەم شێوەیە ڕاهێنرابێت ئەو پشیلانەش دەناسێتەوە کە هەرگیز نەیبینیون، وەک چۆن منداڵێک لە نموونەی زۆرەوە گوێی تیژ و سمێڵ فێر دەبێت.

How wrong is it? The loss functionچەند هەڵەیە؟ کرداری زیان

Epochs, batches and when to stopگەڕی ڕاهێنان، کۆمەڵەکان و کەی ڕابگرین

Training repeats one loop: take a batch of examples, run the forward pass, measure the loss, backpropagate, update the weights. When every training example has been used once, that is one epoch. Big networks train for many epochs on millions of examples.

ڕاهێنان یەک دووپاتە دەکاتەوە: کۆمەڵێک نموونە وەربگرە، ئەنجام بدە، زیانەکە بپێوە، بکە، بگۆڕە. کاتێک هەموو نموونەیەکی ڕاهێنان یەک جار بەکار هات، ئەوە یەک . تۆڕە گەورەکان لەسەر ملیۆنان نموونە بۆ چەندین ڕادەهێنرێن.

How do we know when to stop? Exactly as in Training data and test data: keep some validation data apart. If the training loss still falls but the validation loss starts to rise, the network is memorising: overfitting. Stop there ("early stopping") and measure once on the test data.

چۆن بزانین کەی ڕابگرین؟ ڕێک وەک لە دراوەی ڕاهێنان و دراوەی تاقیکردنەوە: هەندێک جیا ڕابگرە. ئەگەر زیانی ڕاهێنان هێشتا کەم ببێتەوە بەڵام زیانی دەست بکات بە زیادبوون، تۆڕەکە لەبەری دەکات: زیادەگونجاندن. لەوێ ڕایبگرە («ڕاگرتنی زوو») و یەک جار لەسەر بیپێوە.

Left: the training loop as five boxes with arrows: 1 take a batch of examples, 2 forward pass, 3 measure the loss, 4 backpropagation, 5 update the weights, then back to 1 with the next batch; all batches once = 1 epoch. Right (illustration): two curves of loss against epochs. The loss on the training data keeps falling. The loss on the validation data falls, then rises again. A dashed line marks stop here, where the validation loss is lowest; to the right is overfitting.لای چەپ: خولی ڕاهێنان وەک پێنج چوارچێوە بە تیرەوە: 1 کۆمەڵێک نموونە وەربگرە، 2 تێپەڕینی بەرەوپێش، 3 زیانەکە بپێوە، 4 گەڕاندنەوەی هەڵە بۆ دواوە، 5 کێشەکان بگۆڕە، پاشان گەڕانەوە بۆ 1 بە کۆمەڵەی دواتر؛ هەموو کۆمەڵەکان یەک جار = 1 گەڕی ڕاهێنان. لای ڕاست (نموونەیی): دوو چەماوەی زیان بەرامبەر گەڕی ڕاهێنان. زیان لەسەر دراوەی ڕاهێنان هەر کەم دەبێتەوە. زیان لەسەر دراوەی پشتڕاستکردنەوە کەم دەبێتەوە، پاشان دیسان زیاد دەکات. هێڵێکی پچڕپچڕ «لێرە ڕاگرە» نیشان دەدات، لەو شوێنەی زیانی دراوەی پشتڕاستکردنەوە لە کەمترینیدایە؛ لای ڕاستی زیادەگونجاندنە.
The training loop, and stopping when the validation loss starts to rise. ڕاهێنان و ڕاگرتن کاتێک زیانی دەست دەکات بە زیادبوون.CêIT

Why one neuron is not enough: XORبۆچی یەک دەمارەخانەی دەستکرد بەس نییە: XOR

XOR ("exclusive or") answers 1 when exactly one of two inputs is 1, as in the XOR gate of logic design. Draw the four cases on a grid: the two 1s sit on one diagonal and the two 0s on the other. A single neuron can only cut the grid with one straight line, and no straight line puts both 1s on one side and both 0s on the other.

XOR («یان»ی تایبەت) کاتێک 1 دەداتەوە کە ڕێک یەکێک لە دوو 1 بێت، وەک گەیتی XOR لە دیزاینی . چوار حاڵەتەکە لەسەر تۆڕێک بکێشە: دوو 1ـەکە لەسەر یەک تیرەن و دوو 0ـەکە لەسەر تیرەکەی تر. یەک تەنیا دەتوانێت تۆڕەکە بە یەک هێڵی ڕاست ببڕێت و هیچ هێڵێکی ڕاست هەردوو 1ـەکە لە لایەک و هەردوو 0ـەکە لە لایەکی تر دانانێت.

In 1969 Minsky and Papert's book Perceptrons proved this limit, and interest in neural networks fell for years. The way out is a hidden layer: two hidden neurons draw two lines, and the output neuron combines them.

لە ⁦1969⁩دا کتێبی Perceptronsـی Minsky و Papert ئەم سنوورەی سەلماند و بۆ چەند ساڵێک بایەخدان بە کەم بووەوە. ڕێگای دەربازبوون : دوو شاراوە دوو هێڵ دەکێشن و پێکیانەوە دەبەستێت.

Two grids with the four XOR cases: (0,0) gives 0, (1,1) gives 0, (0,1) gives 1, (1,0) gives 1. Left, one neuron (a perceptron): a dashed line tries to separate them, but no straight line puts both 1s on one side and both 0s on the other. Right, a network with a hidden layer: two parallel lines; each cuts off one of the 1s, and the output is 1 outside the middle strip where the 0s are.دوو تۆڕ بە چوار حاڵەتەکەی XOR: (0,0) 0 دەدات، (1,1) 0 دەدات، (0,1) 1 دەدات، (1,0) 1 دەدات. لای چەپ، یەک دەمارەخانەی دەستکرد (پێرسێپترۆن): هێڵێکی پچڕپچڕ هەوڵ دەدات جیایان بکاتەوە، بەڵام هیچ هێڵێکی ڕاست هەردوو 1ـەکە لە لایەک و هەردوو 0ـەکە لە لایەکی تر دانانێت. لای ڕاست، تۆڕێک بە چینێکی شاراوەوە: دوو هێڵی تەریب؛ هەریەکەیان یەکێک لە 1ـەکان جیا دەکاتەوە و دەرخستە لە دەرەوەی ناوچە ناوەڕاستەکە 1ـە، کە 0ـەکانی تێدایە.
XOR needs two lines, so it needs a hidden layer.XOR پێویستی بە دوو هێڵە، بۆیە پێویستی بە هەیە.CêIT

Why one neuron is not enough: XORبۆچی یەک دەمارەخانەی دەستکرد بەس نییە: XOR

A tiny network learns XOR in Pythonتۆڕێکی بچووک بە Python XOR فێر دەبێت

This program trains a 2-2-1 network (2 inputs, 2 hidden neurons, 1 output) with everything from this lesson: sigmoid neurons, the squared-error loss, backpropagation and gradient descent. It uses plain Python only, and random.seed(1) makes the "random" start the same at every run.

ئەم تۆڕێکی ⁦2-2-1⁩ ڕادەهێنێت (⁦2⁩ ، 2 شاراوە، 1 ) بە هەموو ئەوەی لەم وانەیەدا هات: بە ، زیانی دووجای هەڵە، و . تەنیا Pythonـی سادە بەکار دەهێنێت و random.seed(1) وا دەکات دەستپێکی «هەڕەمەکی» لە هەموو جارێکدا وەک یەک بێت.

A 2-2-1 network learns XOR (Python 3.13, no libraries)تۆڕێکی ⁦2-2-1 XOR⁩ فێر دەبێت (⁦Python 3.13⁩، بەبێ کتێبخانە)xor.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import math, random

random.seed(1)                  # the same "random" start every run

def sigmoid(z):
    return 1 / (1 + math.exp(-z))

# XOR: the answer is 1 when exactly one input is 1
data = [([0, 0], 0), ([0, 1], 1), ([1, 0], 1), ([1, 1], 0)]

H = 2                           # neurons in the hidden layer
w_h = [[random.uniform(-1, 1), random.uniform(-1, 1)] for _ in range(H)]
b_h = [0.0] * H
w_o = [random.uniform(-1, 1) for _ in range(H)]
b_o = 0.0
rate = 0.5                      # learning rate

def forward(x):
    h = [sigmoid(w_h[j][0] * x[0] + w_h[j][1] * x[1] + b_h[j]) for j in range(H)]
    y = sigmoid(sum(w_o[j] * h[j] for j in range(H)) + b_o)
    return h, y

for epoch in range(10001):
    loss = 0
    for x, target in data:
        h, y = forward(x)                         # 1. forward pass
        loss += (y - target) ** 2                 # 2. loss
        d_o = 2 * (y - target) * y * (1 - y)      # 3. backpropagation
        for j in range(H):
            d_h = d_o * w_o[j] * h[j] * (1 - h[j])
            w_o[j] -= rate * d_o * h[j]           # 4. gradient descent
            w_h[j][0] -= rate * d_h * x[0]
            w_h[j][1] -= rate * d_h * x[1]
            b_h[j] -= rate * d_h
        b_o -= rate * d_o
    if epoch % 2000 == 0:
        print(f"epoch {epoch:5}: loss {loss / 4:.4f}")

for x, target in data:
    print(x, "->", round(forward(x)[1], 3), " target", target)
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 12-15

Random starting weights between −1 and 1; biases start at 0.

دەستپێک بە هەڕەمەکی لە نێوان ⁦−1⁩ و 1دان؛ لە 0ـەوە دەست پێ دەکەن.

Lineدێڕی 18-21

The forward pass: hidden layer first, then the output neuron.

: سەرەتا ، پاشان .

Lineدێڕی 27

The squared error of this example is added to the loss.

دووجای هەڵەی ئەم نموونەیە دەخرێتە سەر زیانەکە.

Lineدێڕی 28-30

Backpropagation: d_o is the slope for the output neuron; d_h passes its share back to each hidden neuron (y·(1 − y) is the slope of the sigmoid).

: d_o ؛ d_h بەشی خۆی دەگەڕێنێتەوە بۆ هەر لە (⁦y·(1 − y)⁩ ).

Lineدێڕی 31-35

Gradient descent: every weight and bias takes a small step against its slope.

: هەموو و هەنگاوێکی بچووک بە پێچەوانەی دەنێت.

After training, the hidden neurons have found two ideas: one fires for "only the second input", the other for "only the first", and the output neuron fires for either one. That is XOR built from AND, OR and NOT, as in XOR from basic gates, but nobody programmed it: the network found it.

دوای ڕاهێنان، دوو بیرۆکەیان دۆزیوەتەوە: یەکێکیان بۆ «تەنیا دووەم» چالاک دەبێت، ئەوی تر بۆ «تەنیا یەکەم» و بۆ هەر یەکێکیان چالاک دەبێت. ئەمە XORـە کە لە AND، OR و NOT دروست کراوە، وەک لە XOR لە AND، OR و NOTـەوە، بەڵام کەس بەرنامەی بۆ دانەنا: تۆڕەکە خۆی دۆزییەوە.

Seeing pictures: convolutional neural networksبینینی وێنە: تۆڕە دەمارییە کانڤۆلووشنییەکان

A phone photo has about 36 million numbers (a picture is a grid of numbers). A fully connected neuron would need a weight for each of them, and a cat in the corner would look completely different from a cat in the middle. A convolutional neural network (CNN) solves both problems with small filters: a 3 × 3 grid of weights slides over the picture, and at each place it multiplies the pixels under it by its weights and adds them up.

وێنەیەکی مۆبایل نزیکەی ⁦36⁩ ملیۆن ژمارەی تێدایە (وێنە تۆڕێکی ژمارەیە). کە تەواو بەستراو بێت پێویستی بە دەبێت بۆ هەر یەکێکیان و پشیلەیەک لە گۆشەی وێنەکەدا بە تەواوی جیاواز دەردەکەوێت لە پشیلەیەک لە ناوەڕاستدا. هەردوو کێشەکە بە بچووک چارەسەر دەکات: تۆڕێکی ⁦3 × 3⁩ لە بەسەر وێنەکەدا دەخشێت و لە هەر شوێنێک ئەو لە ژێریدان لە خۆی دەدات و کۆیان دەکاتەوە.

The same few weights are used everywhere in the picture, so a filter that finds an edge finds it in any corner. The numbers it produces form a feature map: big where its pattern is.

هەمان چەند لە هەموو شوێنێکی وێنەکەدا بەکار دێن، بۆیە کە لێوارێک دەدۆزێتەوە لە هەر گۆشەیەکدا دەیدۆزێتەوە. ئەو ژمارانەی دروستی دەکات نەخشەیەکی تایبەتمەندی پێک دێنن: لەو شوێنەی شێوازەکەی لێیە گەورەن.

Animation. Left: a 5 × 5 grey picture, 0 for dark and 9 for bright; the bright part is on the right. Middle: a 3 × 3 filter with −1, 0, 1 in each row. A 3 × 3 window moves over the picture in nine steps, left to right and top to bottom. At each step the filter computes right column minus left column, for example (9 + 9 + 0) − (0 + 0 + 0) = 18, and the number fills one cell of the 3 × 3 feature map on the right: 18, 27, 9 / 9, 27, 18 / 0, 18, 27. Last frame: big numbers mark where dark turns bright, an edge; a CNN learns the numbers of its filters itself.
Animation. Left: a 5 × 5 grey picture, 0 for dark and 9 for bright; the bright part is on the right. Middle: a 3 × 3 filter with −1, 0, 1 in each row. A 3 × 3 window moves over the picture in nine steps, left to right and top to bottom. At each step the filter computes right column minus left column, for example (9 + 9 + 0) − (0 + 0 + 0) = 18, and the number fills one cell of the 3 × 3 feature map on the right: 18, 27, 9 / 9, 27, 18 / 0, 18, 27. Last frame: big numbers mark where dark turns bright, an edge; a CNN learns the numbers of its filters itself.
A 3 × 3 edge filter slides over a 5 × 5 picture and builds a feature map. لێواردۆزی ⁦3 × 3⁩ بەسەر وێنەیەکی ⁦5 × 5⁩دا دەخشێت و نەخشەیەکی تایبەتمەندی دروست دەکات.CêIT

Seeing pictures: convolutional neural networksبینینی وێنە: تۆڕە دەمارییە کانڤۆلووشنییەکان

Inside a CNN: filters, pooling and the answerناو تۆڕێکی دەماریی کانڤۆلووشنی: فلتەرەکان، پوختەکردن و وەڵام

A real CNN stacks several steps. A convolution layer has many filters (edges in every direction, colours) and passes each feature map through ReLU. A pooling step then makes the maps smaller: max pooling keeps the largest number of each 2 × 2 square, so the square 1, 3, 4, 6 becomes 6. Deeper convolution layers combine edges into shapes such as ears and eyes. At the end a fully connected layer turns everything into one score per class, and softmax turns the scores into probabilities that add up to 1.

ڕاستەقینە چەند هەنگاوێک لەسەر یەک دادەنێت. کانڤۆلووشن چەندین هەیە (لێوار بە هەموو ئاڕاستەیەک، ڕەنگ) و هەر نەخشەیەکی تایبەتمەندی بە تێدەپەڕێنێت. پاشان هەنگاوی نەخشەکان بچووکتر دەکات: بە گەورەترین ژمارە، گەورەترین ژمارەی هەر چوارگۆشەیەکی ⁦2 × 2⁩ دەهێڵێتەوە، بۆیە چوارگۆشەی 1، 3، 4، 6 دەبێتە 6. قووڵتری کانڤۆلووشن لێوارەکان دەکەنە شێوە وەک گوێ و چاو. لە کۆتاییدا تەواو بەستراو هەموو شتێک دەکاتە یەک نمرە بۆ هەر پۆلێک و نمرەکان دەکاتە کە کۆیان 1ـە.

A convolutional neural network that sorts photos, from left to right: a photo of a cat (224 × 224 × 3 numbers); convolution + ReLU, where small filters find edges (a stack of large maps); pooling, which keeps the strongest values and makes the maps smaller; convolution + ReLU again for shapes such as ears, eyes and whiskers (more, smaller maps); pooling; a fully connected layer of a few neurons; and the answer: cat 0.92, dog 0.06, other 0.02. An arrow underneath: deeper layers have smaller maps, more patterns and bigger ideas.تۆڕێکی دەماریی کانڤۆلووشنی کە وێنەکان پۆلێن دەکات، لە چەپەوە بۆ ڕاست: وێنەی پشیلەیەک (224 × 224 × 3 ژمارە)؛ کانڤۆلووشن + ReLU، کە فلتەری بچووک لێوار دەدۆزێتەوە (کۆمەڵێک نەخشەی گەورە)؛ پوختەکردن، کە بەهێزترین بەها دەهێڵێتەوە و نەخشەکان بچووکتر دەکات؛ دیسان کانڤۆلووشن + ReLU بۆ شێوەی وەک گوێ، چاو و سمێڵ (نەخشەی زیاتر و بچووکتر)؛ پوختەکردن؛ چینێکی تەواو بەستراو بە چەند دەمارەخانەی دەستکرد؛ و وەڵامەکە: پشیلە 0.92، سەگ 0.06، تر 0.02. تیرێک لە خوارەوە: چینەکانی قووڵتر نەخشەی بچووکتر، شێوازی زیاتر و بیرۆکەی گەورەتریان هەیە.
The steps of a CNN: convolution and ReLU, pooling, and a fully connected layer with softmax.هەنگاوەکانی : کانڤۆلووشن و ، و تەواو بەستراو لەگەڵ .CêIT

CNNs are older than they look: Yann LeCun's network read handwritten postcodes in 1989. Today they help phones find faces in photos and doctors read X-rays; how such vision systems fail is taught in When AI gets it wrong.

لەوە کۆنترن کە دەردەکەون: تۆڕەکەی Yann LeCun لە ⁦1989⁩دا پۆستکۆدی دەستنووسی دەخوێندەوە. ئەمڕۆ یارمەتی مۆبایل دەدەن ڕووخسار لە وێنەکاندا بدۆزێتەوە و یارمەتی پزیشکان دەدەن وێنەی تیشکی X بخوێننەوە؛ ئەم جۆرە سیستەمانەی بینین چۆن هەڵە دەکەن لە کاتێک ژیریی دەستکرد هەڵە دەکات فێر دەکرێت.

Seeing pictures: convolutional neural networksبینینی وێنە: تۆڕە دەمارییە کانڤۆلووشنییەکان

Deep learning at work: a network that found planetsفێربوونی قووڵ لە کاردا: تۆڕێک کە هەسارەی دۆزییەوە

NASA's Kepler space telescope (2009–2018) measured the brightness of about 150,000 stars again and again. When a planet passes in front of its star, the star looks a tiny bit darker for a few hours: a small dip in its light curve. Real dips are faint and easy to confuse with noise, so people had checked mostly the clearest ones.

تەلەسکۆپی ئاسمانیی Keplerـی ⁦NASA (2009–2018)⁩ ڕووناکیی نزیکەی ⁦150,000⁩ ئەستێرەی دووپاتە و دووپاتە پێوا. کاتێک هەسارەیەک بە بەردەم ئەستێرەکەیدا تێدەپەڕێت، ئەستێرەکە بۆ چەند کاتژمێرێک کەمێک تاریکتر دیار دەبێت: دابەزینێکی بچووک لە هێڵی ڕووناکییەکەیدا. دابەزینە ڕاستەقینەکان لاوازن و ئاسان لەگەڵ ژاوەژاو تێکەڵ دەبن، بۆیە خەڵک زیاتر ڕوونترینەکانیان پشکنیبوو.

In 2017 Christopher Shallue (Google) and Andrew Vanderburg (University of Texas at Austin) trained a deep convolutional neural network on 15,000 signals that people had already labelled planet or not a planet; it read each light curve like a one-row picture. On test signals it was right 96% of the time. They let it search 670 stars with known planets, and it found two that had been missed: Kepler-90i, which gives the star Kepler-90 eight known planets, as many as our Sun, and Kepler-80g. NASA announced them on 14 December 2017. In 2019 a version for Kepler's second mission, AstroNet-K2, found two more: K2-293b and K2-294b.

لە ⁦2017⁩دا ⁦Christopher Shallue (Google)⁩ و Andrew Vanderburg (زانکۆی تەکساس لە ئۆستن) قووڵیان لەسەر ⁦15,000⁩ ئاماژە ڕاهێنا کە خەڵک پێشتر بە هەسارە یان هەسارە نییە نیشانەیان کردبوون؛ هەر هێڵێکی ڕووناکی وەک وێنەیەکی یەک ڕیز دەخوێندەوە. لەسەر ئاماژەکانی تاقیکردنەوە لە ⁦96⁩٪ی جارەکاندا ڕاست بوو. پاشان هێشتیان لە ⁦670⁩ ئەستێرەدا بگەڕێت کە هەسارەی زانراویان هەبوو و دوو هەسارەی دۆزییەوە کە لە چاو ون ببوون: ⁦Kepler-90i⁩، کە ئەستێرەی ⁦Kepler-90⁩ دەکاتە خاوەنی هەشت هەسارەی زانراو، هێندەی خۆری ئێمە، هەروەها ⁦Kepler-80g⁩. NASA لە ⁦14⁩ی کانوونی یەکەمی ⁦2017⁩دا ڕایگەیاندن. لە ⁦2019⁩دا وەشانێک بۆ ئەرکی دووەمی Kepler، بە ناوی ⁦AstroNet-K2⁩، دوانی دیکەی دۆزییەوە: ⁦K2-293b⁩ و ⁦K2-294b⁩.

Left: a star with a dark planet shown at three positions; in the middle it passes in front of the star. Right: a graph of the star's brightness against time. The line stays level with small noise, then drops in a box-shaped dip while the planet is in front, and the same dip comes again on the next orbit. A neural network learned to tell real planet dips from noise and false alarms.لای چەپ: ئەستێرەیەک لەگەڵ هەسارەیەکی تاریک لە سێ شوێندا؛ لە ناوەڕاستدا بە بەردەم ئەستێرەکەدا تێدەپەڕێت. لای ڕاست: گرافێکی ڕووناکیی ئەستێرەکە بەرامبەر کات. هێڵەکە بە ژاوەژاوێکی کەمەوە ڕێک دەمێنێتەوە، پاشان کاتێک هەسارەکە لە بەردەمدایە بە دابەزینێکی چوارگۆشەیی دادەبەزێت و هەمان دابەزین لە سووڕانەوەی دواتردا دووپاتە دەبێتەوە. تۆڕێکی دەماری فێر بوو دابەزینی ڕاستەقینەی هەسارە لە ژاوەژاو و هەڵەی ساختە جیا بکاتەوە.
A planet passing its star makes a small, repeating dip in the star's light.هەسارەیەک کە بە بەردەم ئەستێرەکەیدا تێدەپەڕێت دابەزینێکی بچووک و دووپاتەبووەوە لە ڕووناکیی ئەستێرەکەدا دروست دەکات.CêIT

This is supervised deep learning at work: labelled examples in, a classifier out, and a real discovery at the end.

ئەمە چاودێریکراوە لە کاردا: نموونەی نیشانەکراو دەچێتە ژوورەوە، پۆلێنکەرێک دێتە دەرەوە و لە کۆتاییدا دۆزینەوەیەکی ڕاستەقینە.

Words and sequences: RNNs and transformersوشە و زنجیرە: تۆڕە دەمارییە گەڕاوەکان و ترانسفۆرمەرەکان

Text, speech and sensor readings come as sequences, where order matters. A recurrent neural network (RNN) reads one item at a time and carries a memory (a hidden state) from each word to the next. It works, but it is slow, because word 10 must wait for word 9, and the memory of early words fades in long texts.

دەق، قسە و خوێندنەوەی وەک زنجیرە دێن، کە ڕیزبەندییان گرنگە. هەر جارە یەک بڕگە دەخوێنێتەوە و بیرەوەرییەک لە هەر وشەیەکەوە بۆ وشەی دواتر دەبات. کار دەکات، بەڵام خاوە، چونکە وشەی ⁦10⁩ دەبێت چاوەڕێی وشەی 9 بکات و لە دەقی درێژدا بیرەوەریی وشە سەرەتاییەکان کاڵ دەبێتەوە.

In 2017 the paper Attention Is All You Need introduced the transformer. It drops the step-by-step memory: with attention, every word looks at every other word at the same time and decides which ones matter for it. Because all words are processed together, GPUs can work on them in parallel. Transformers are the base of today's large language models.

لە ⁦2017⁩دا توێژینەوەی Attention Is All You Need ـی ناساند. ئەو بیرەوەرییە هەنگاو بە هەنگاوە لادەبات: بە ، هەموو وشەیەک لە یەک کاتدا سەیری هەموو وشەکانی تر دەکات و بڕیار دەدات کامیان بۆ ئەو گرنگن. چونکە هەموو وشەکان پێکەوە کاریان لەسەر دەکرێت، دەتوانێت هاوکات کاریان لەسەر بکات. بنەمای ئەمڕۆن.

Top, an RNN: the sentence "Aram drinks tea every morning" in five boxes; each word goes into a memory circle h, and arrows carry the memory from word to word. It is slow on long texts: the memory of early words fades. Bottom, a transformer: the same five words with curved lines joining every word to every other word (attention), all at once, so GPUs can do it in parallel.سەرەوە، تۆڕێکی دەماریی گەڕاوە: ڕستەی «ئارام هەموو بەیانییەک چا دەخوات» لە پێنج چوارچێوەدا؛ هەر وشەیەک دەچێتە ناو بازنەیەکی بیرەوەریی h و تیرەکان بیرەوەرییەکە لە وشەیەکەوە بۆ وشەی دواتر دەبەن. لە دەقی درێژدا لاوازە: بیرەوەریی وشە سەرەتاییەکان کاڵ دەبێتەوە. خوارەوە، ترانسفۆرمەرێک: هەمان پێنج وشە بە هێڵی چەماوە کە هەموو وشەیەک بە هەموو وشەکانی ترەوە دەبەستن (سەرنجی خۆیی)، هەموو لە یەک کاتدا، بۆیە یەکەی چارەسەرکردنی وێنەیی دەتوانێت هاوکات بیانکات.
An RNN reads word by word; a transformer lets every word look at all the others at once. وشە بە وشە دەخوێنێتەوە؛ ڕێگە دەدات هەموو وشەیەک لە یەک کاتدا سەیری هەموو ئەوانی تر بکات.CêIT

Words and sequences: RNNs and transformersوشە و زنجیرە: تۆڕە دەمارییە گەڕاوەکان و ترانسفۆرمەرەکان

From deep learning to generative AIلە فێربوونی قووڵەوە بۆ ژیریی دەستکردی بەرهەمهێنەر

The model behind a chatbot, a large language model, is a very deep transformer with billions of weights, trained with the same loss, gradient descent and backpropagation you met in this lesson. Three ideas lead from here to chatbots; the Generative AI course teaches each one:

پشت ، واتە ، زۆر قووڵە بە ملیاران ، کە بە هەمان زیان، و ڕاهێنراوە کە لەم وانەیەدا بینیت. سێ بیرۆکە لێرەوە دەتبەن بۆ ؛ کۆرسی هەریەکەیان فێر دەکات:

  • Tokens: text is cut into small pieces, and the model predicts the next piece again and again; a Kurdish sentence usually needs more tokens than the same sentence in English. How a language model writes
  • Embeddings: each token becomes a long list of learned numbers, so words used in similar ways, such as Kurdistan and Erbil, get similar vectors. Vectors and embeddings
  • Prompts: a model knows the world only from what it was trained on, so a clear, detailed prompt gets a better answer. Prompt engineering
  • : دەق دەکرێت بە پارچەی بچووک و دووپاتە و دووپاتە پێشبینیی پارچەی دواتر دەکات؛ ڕستەیەکی کوردی زۆرجار زیاتری پێویستە لە هەمان ڕستە بە ئینگلیزی. مۆدێلی زمان چۆن دەنووسێت
  • : هەر دەبێتە لیستێکی درێژی ژمارەی فێربوو، بۆیە ئەو وشانەی بە شێوەی لێکچوو بەکار دێن، وەک کوردستان و هەولێر، لێکچوو وەردەگرن. ئاڕاستەبڕەکان و ئیمبەدینگەکان
  • : جیهان تەنیا لەو دەناسێت کە لەسەری ڕاهێنراوە، بۆیە ڕوون و ورد وەڵامێکی باشتر وەردەگرێت. ئەندازیاریی هەوێن
Four columns under the Kurdish text so far. 1 Tokenization: the sentence is cut into pieces, each with an id number (pieces and numbers are only an example). 2 Embeddings: one vector of numbers per token. 3 Transformer blocks: self-attention (tokens look at each other) and a feed-forward network (adds more meaning), repeated over many layers; normalisation keeps the numbers steady. 4 Next-token probabilities: و 22%, کە 18%, چونکە 15%, بەڵام 10%, others 35% (invented numbers). A dashed arrow goes back to the start: pick a token, add it to the text and start again.چوار ستوون لە ژێر دەقی کوردیی تا ئێستادا. 1 تۆکنکردن: ڕستەکە دەکرێت بە پارچە، هەر یەکەیان بە ژمارەیەکی ناسنامە (پارچە و ژمارەکان تەنیا نموونەن). 2 ئیمبەدینگەکان: ئاڕاستەبڕێک لە ژمارە بۆ هەر تۆکنێک. 3 بلۆکەکانی ترانسفۆرمەر: سەرنجی خۆیی (تۆکنەکان سەیری یەکتر دەکەن) و تۆڕێکی بچووک (واتای زیاتر زیاد دەکات)، کە لە چەندین چیندا دووپاتە دەبنەوە؛ نۆرماڵکردن ژمارەکان جێگیر دەهێڵێتەوە. 4 ئەگەری تۆکنی داهاتوو: و 22٪، کە 18٪، چونکە 15٪، بەڵام 10٪، ئەوانی دیکە 35٪ (ژمارەی نموونەیی). تیرێکی پچڕپچڕ بۆ سەرەتا دەگەڕێتەوە: تۆکنێک هەڵبژێرە، بیخەرە سەر دەقەکە و دیسان دەست پێ بکەرەوە.
How a GPT-style model writes the next token, again and again. وەک GPT چۆن داهاتوو دەنووسێت، دووپاتە و دووپاتە.CêIT

Why deep learning took off in 2012بۆچی فێربوونی قووڵ لە ⁦2012⁩دا هەستایەوە

Most ideas in this lesson are old: the artificial neuron (1943), the perceptron (1958), backpropagation (1986), CNNs (1989). Deep networks still worked badly for decades. Three things changed around 2010:

زۆربەی بیرۆکەکانی ئەم وانەیە کۆنن: ⁦(1943)⁩، ⁦(1958)⁩، ⁦(1986)⁩، ⁦(1989)⁩. هێشتا بۆ چەندین دەیە تۆڕە قووڵەکان باش کاریان نەدەکرد. نزیکەی ⁦2010⁩ سێ شت گۆڕا:

  • Big data: the web gave millions of labelled examples. ImageNet, started by Fei-Fei Li's team, collected over 14 million labelled photos; its yearly contest used 1.2 million training photos in 1,000 classes.
  • GPUs: a graphics processor has thousands of small cores that do the same multiply-and-add on many numbers at once, exactly what a layer needs (Graphics processors).
  • Better methods: ReLU instead of the sigmoid in hidden layers, and dropout (switching off random neurons during training) against overfitting.
  • : وێب ملیۆنان نموونەی نیشانەکراوی دابین کرد. ImageNet، کە تیمەکەی ⁦Fei-Fei Li⁩ دەستیان پێ کرد، زیاتر لە ⁦14⁩ ملیۆن وێنەی نیشانەکراوی کۆکردەوە؛ پێشبڕکێ ساڵانەکەی ⁦1.2⁩ ملیۆن وێنەی ڕاهێنانی لە ⁦1,000⁩ پۆلدا بەکار دەهێنا.
  • : هەزاران ناوکی بچووکی هەیە کە هەمان لێکدان و کۆکردنەوە لەسەر ژمارەیەکی زۆر لە یەک کاتدا دەکەن، ڕێک ئەوەی پێویستیەتی (یەکەی چارەسەرکردنی وێنەیی).
  • ڕێگای باشتر: لە جیاتی لە و dropout (کوژاندنەوەی هەڕەمەکیی هەندێک لە کاتی ڕاهێناندا) دژی .

In 2012 AlexNet, a deep CNN by Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton, trained on two gaming GPUs, won the ImageNet contest by a wide margin. After that, almost every vision system switched to deep learning.

لە ⁦2012⁩دا AlexNet، قووڵی Alex Krizhevsky، Ilya Sutskever و Geoffrey Hinton کە لەسەر دوو ڕاهێنرا کە بۆ یاری دروست کرابوون، بە جیاوازییەکی زۆر پێشبڕکێی ImageNetـی بردەوە. لەوە بەدواوە نزیکەی هەموو سیستەمێکی بینین ڕووی کردە .

A bar chart of the ImageNet contest 2012, top-5 error, where lower is better. AlexNet, a deep CNN trained on 2 gaming GPUs: 15.3%. Next best entry, using older methods: 26.2%. Below: 1.2 million labelled training photos, 1,000 classes, about 60 million weights and biases; big data, GPUs and better methods (ReLU, dropout) made deep learning work.گرافێکی ستوونی بۆ پێشبڕکێی ImageNet 2012، هەڵەی پێنج وەڵامە سەرەکییەکە، کە کەمتر باشترە. AlexNet، تۆڕێکی دەماریی کانڤۆلووشنیی قووڵ کە لەسەر 2 GPUـی یاری ڕاهێنرا: 15.3٪. باشترینی دواتر، بە ڕێگای کۆنتر: 26.2٪. لە خوارەوە: 1.2 ملیۆن وێنەی نیشانەکراوی ڕاهێنان، 1,000 پۆل، نزیکەی 60 ملیۆن کێش و بایەس؛ دراوەی گەورە، GPU و ڕێگای باشتر (ReLU، dropout) فێربوونی قووڵیان خستە کار.
AlexNet's error was 15.3% against 26.2% for the next best entry (ImageNet, 2012).هەڵەی ⁦AlexNet 15.3⁩٪ بوو بەرامبەر ⁦26.2⁩٪ بۆ باشترینی دواتر (ImageNet، ⁦2012⁩).CêIT

Why deep learning took off in 2012بۆچی فێربوونی قووڵ لە ⁦2012⁩دا هەستایەوە

From 1943 to the 2024 Nobel Prizeلە ⁦1943⁩ـەوە تا خەڵاتی نۆبڵی ⁦2024⁩

The timeline shows the main steps. Two of them were honoured with the highest prizes: in 2019 Yoshua Bengio, Geoffrey Hinton and Yann LeCun received the 2018 ACM Turing Award, named after Alan Turing, for making deep neural networks "a critical component of computing". On 8 October 2024 the Nobel Prize in Physics went to John Hopfield (Princeton) and Geoffrey Hinton (Toronto) "for foundational discoveries and inventions that enable machine learning with artificial neural networks": Hopfield's network of 1982 stores and recalls patterns, and Hinton's Boltzmann machine learns the typical features of data.

هێڵی کاتەکە هەنگاوە سەرەکییەکان پیشان دەدات. دووانیان بەرزترین خەڵاتیان وەرگرت: لە ⁦2019⁩دا Yoshua Bengio، Geoffrey Hinton و Yann LeCun خەڵاتی ACM Turingـی ⁦2018⁩یان وەرگرت، کە ناوی ئالان تیورینگـی لەسەرە، چونکە قووڵیان کردە «بەشێکی گرنگی ». لە 8ی تشرینی یەکەمی ⁦2024⁩دا خەڵاتی نۆبڵی فیزیا درا بە ⁦John Hopfield (Princeton)⁩ و ⁦Geoffrey Hinton (Toronto)⁩ بۆ «دۆزینەوە و داهێنانە بنەڕەتییەکان کە بە دەستکرد دەگونجێنن»: تۆڕەکەی Hopfield لە ⁦1982⁩ شێواز هەڵدەگرێت و دەیانگەڕێنێتەوە و ئامێری Boltzmannـی Hinton تایبەتمەندییە باوەکانی فێر دەبێت.

A timeline with nine points. 1943: McCulloch and Pitts, a maths model of a neuron. 1958: Frank Rosenblatt, the perceptron learns. 1969: Minsky and Papert, one layer cannot do XOR. 1982: Hopfield network, a memory for patterns. 1986: backpropagation, Rumelhart, Hinton and Williams. 1989: Yann LeCun, a CNN reads postcodes. 2012: AlexNet wins ImageNet, trained on GPUs. 2017: the transformer and attention. 2024: Nobel Prize in Physics for Hopfield and Hinton. Below: most ideas come from 1943–1989; big data and GPUs made them work after 2010.هێڵێکی کات بە نۆ خاڵ. 1943: McCulloch و Pitts، مۆدێلێکی بیرکاریی دەمارەخانە. 1958: Frank Rosenblatt، پێرسێپترۆن فێر دەبێت. 1969: Minsky و Papert، یەک چین XOR ناکات. 1982: تۆڕی Hopfield، بیرەوەرییەک بۆ شێوازەکان. 1986: گەڕاندنەوەی هەڵە بۆ دواوە، Rumelhart، Hinton و Williams. 1989: Yann LeCun، تۆڕێکی دەماریی کانڤۆلووشنی پۆستکۆد دەخوێنێتەوە. 2012: AlexNet ImageNet دەباتەوە، لەسەر GPU ڕاهێنرا. 2017: ترانسفۆرمەر و سەرنجی خۆیی. 2024: خەڵاتی نۆبڵی فیزیا بۆ Hopfield و Hinton. لە خوارەوە: زۆربەی بیرۆکەکان لە نێوان 1943 و 1989دا هاتن؛ دراوەی گەورە و GPU دوای 2010 بەکاریان خستن.
Neural networks from 1943 to the 2024 Nobel Prize. لە ⁦1943⁩ـەوە تا خەڵاتی نۆبڵی ⁦2024⁩.CêIT

Common mistakesهەڵە باوەکان

A mistake in code: in Python, * between two lists does not multiply number by number.

هەڵەیەک لە کۆددا: لە Pythonـدا، * لە نێوان دوو لیستدا ژمارە بە ژمارە لێکیان نادات.

Wrong: multiplying two listsهەڵە: لێکدانی دوو لیستwrong_sum.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
inputs = [0.9, 0.8]
weights = [3.0, 2.0]
bias = -3.5

z = inputs * weights + bias
print(z)
Right: pair them with zip and add the productsڕاست: بە zip جووتیان بکە و لێکدانەکان کۆ بکەرەوەright_sum.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
inputs = [0.9, 0.8]
weights = [3.0, 2.0]
bias = -3.5

z = sum(x * w for x, w in zip(inputs, weights)) + bias
print(round(z, 2))

Exercisesڕاهێنانەکان

Exerciseڕاهێنان1. One neuron by hand1. یەک دەمارەخانەی دەستکرد بە دەست

A neuron has inputs 2 and 1, weights 0.5 and −1, and bias 0.5. Find z, then the output with ReLU and with the sigmoid.

2 و 1، ⁦0.5⁩ و ⁦−1⁩ و ⁦0.5⁩ـی هەیە. z بدۆزەوە، پاشان بە و بە .

Show answerوەڵامەکە پیشان بدە

z = 0.5 × 2 + (−1) × 1 + 0.5 = 1 − 1 + 0.5 = 0.5. ReLU(0.5) = 0.5. Sigmoid: 1 / (1 + e^(−0.5)) ≈ 0.622 (checked with Python).

⁦z = 0.5 × 2 + (−1) × 1 + 0.5 = 1 − 1 + 0.5 = 0.5. ReLU(0.5) = 0.5⁩. : ⁦1 / (1 + e^(−0.5)) ≈ 0.622⁩ (بە Python پشکنرا).

Exerciseڕاهێنان2. Count the numbers to learn2. ژمارەکانی فێربوون بژمێرە

A fully connected network has 4 inputs, a hidden layer of 3 neurons and an output layer of 2 neurons. How many weights and biases does training have to learn?

تۆڕێکی تەواو بەستراو 4 ، بە 3 و بە 2 هەیە. ڕاهێنان دەبێت فێری چەند و ببێت؟

Hintئاماژە

Each neuron has one weight per input coming in, plus one bias.

هەر بۆ هەر کە دێتە ژوورەوە یەک هەیە، لەگەڵ یەک .

Show answerوەڵامەکە پیشان بدە

Hidden layer: 4 × 3 = 12 weights + 3 biases = 15. Output layer: 3 × 2 = 6 weights + 2 biases = 8. Total: 23.

: ⁦4 × 3 = 12⁩ + 3 = ⁦15⁩. : ⁦3 × 2 = 6⁩ + 2 = 8. کۆی گشتی: ⁦23⁩.

Exerciseڕاهێنان3. Two steps of gradient descent3. دوو هەنگاوی دابەزینی گرادیەنت

The loss of one weight is L=(w−5)2L = (w - 5)^2, so its slope is 2(w−5)2(w - 5). Start at w = 1 with learning rate 0.25 and do two steps. What happens to the loss?

زیانی یەک L=(w−5)2L = (w - 5)^2ـە، بۆیە 2(w−5)2(w - 5)ـە. لە ⁦w = 1⁩ـەوە بە ⁦0.25⁩ دەست پێ بکە و دوو هەنگاو بنێ. زیانەکە چی لێ دێت؟

Show answerوەڵامەکە پیشان بدە
w0=1,L=16,slope=2(1−5)=−8w1=1−0.25×(−8)=3,L=4,slope=−4w2=3−0.25×(−4)=4,L=1\begin{aligned} w_0 &= 1, & L &= 16, & \text{slope} &= 2(1-5) = -8 \\ w_1 &= 1 - 0.25 \times (-8) = 3, & L &= 4, & \text{slope} &= -4 \\ w_2 &= 3 - 0.25 \times (-4) = 4, & L &= 1 \end{aligned}

The loss falls 16 → 4 → 1 and w moves towards the best value 5.

زیانەکە ⁦16⁩، 4، 1 دەبێت و w بەرەو باشترین بەها کە 5ـە دەڕوات.

Exerciseڕاهێنان4. A feature map by hand4. نەخشەیەکی تایبەتمەندی بە دەست

Use the 5 × 5 picture and the edge filter of the convolution animation. Compute the top-left number of the feature map by hand, then check all nine with Python.

وێنە ⁦5 × 5⁩ـەکە و لێواردۆزی ئەنیمەیشنەکەی کانڤۆلووشن بەکار بهێنە. ژمارەی سەرەوەی لای چەپی نەخشەی تایبەتمەندی بە دەست حیساب بکە، پاشان هەر نۆیان بە Python بپشکنە.

Show answerوەڵامەکە پیشان بدە

The top-left window covers rows 1–3 and columns 1–3. Right column 9 + 9 + 0 = 18, left column 0 + 0 + 0 = 0, so 18 − 0 = 18.

پەنجەرەی سەرەوەی لای چەپ ڕیزەکانی 1 تا 3 و ستوونەکانی 1 تا 3 دەگرێتەوە. ستوونی ڕاست ⁦9 + 9 + 0 = 18⁩، ستوونی چەپ ⁦0 + 0 + 0 = 0⁩، بۆیە ⁦18 − 0 = 18⁩.

Convolution with plain Pythonکانڤۆلووشن بە Pythonـی سادەconv.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
# A 5x5 grey picture: 0 = dark, 9 = bright
image = [
    [0, 0, 9, 9, 9],
    [0, 0, 9, 9, 9],
    [0, 0, 0, 9, 9],
    [0, 0, 0, 9, 9],
    [0, 0, 0, 0, 9],
]
# A 3x3 filter that reacts to "dark on the left, bright on the right"
edge = [
    [-1, 0, 1],
    [-1, 0, 1],
    [-1, 0, 1],
]

def convolve(img, f):
    size = len(img) - len(f) + 1          # 5 - 3 + 1 = 3
    out = []
    for r in range(size):
        row = []
        for c in range(size):
            total = 0
            for i in range(3):
                for j in range(3):
                    total += img[r + i][c + j] * f[i][j]
            row.append(total)
        out.append(row)
    return out

feature_map = convolve(image, edge)
for row in feature_map:
    print(row)
Exerciseڕاهێنان5. Max pooling5. پوختەکردن بە گەورەترین

Apply 2 × 2 max pooling to this grid: rows 1 3 0 2 / 4 6 1 0 / 0 2 9 5 / 1 0 3 7.

بە گەورەترین بە چوارگۆشەی ⁦2 × 2⁩ لەسەر ئەم تۆڕە جێبەجێ بکە: ڕیزەکان ⁦1 3 0 2 / 4 6 1 0 / 0 2 9 5 / 1 0 3 7⁩.

Show answerوەڵامەکە پیشان بدە

Top-left square 1, 3, 4, 6 → 6; top-right 0, 2, 1, 0 → 2; bottom-left 0, 2, 1, 0 → 2; bottom-right 9, 5, 3, 7 → 9. Result: 6 2 / 2 9.

چوارگۆشەی سەرەوەی چەپ 1، 3، 4، 6 ← 6؛ سەرەوەی ڕاست 0، 2، 1، 0 ← 2؛ خوارەوەی چەپ 0، 2، 1، 0 ← 2؛ خوارەوەی ڕاست 9، 5، 3، 7 ← 9. ئەنجام: ⁦6 2 / 2 9⁩.

2 × 2 max poolingپوختەکردن ⁦2 × 2⁩ بە گەورەترینpool.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
grid = [
    [1, 3, 0, 2],
    [4, 6, 1, 0],
    [0, 2, 9, 5],
    [1, 0, 3, 7],
]
pooled = [[max(grid[r][c], grid[r][c + 1], grid[r + 1][c], grid[r + 1][c + 1])
           for c in (0, 2)] for r in (0, 2)]
print(pooled)
Exerciseڕاهێنان6. From XOR to OR6. لە XOR ـەوە بۆ OR

In xor.py, change the last example to ([1, 1], 1) so the network learns OR. Run it. Does it learn? Would a single neuron be enough for OR?

لە xor.pyـدا دوایین نموونە بگۆڕە بۆ ([1, 1], 1) بۆ ئەوەی تۆڕەکە OR فێر ببێت. کاری پێ بکە. فێر دەبێت؟ ئایا یەک بۆ OR بەس دەبوو؟

Show answerوەڵامەکە پیشان بدە
Our run of the changed program (python3.13)کارپێکردنی بەرنامەی گۆڕدراو ⁦(python3.13)⁩
epoch     0: loss 0.2550
epoch  2000: loss 0.0003
epoch  4000: loss 0.0001
epoch  6000: loss 0.0001
epoch  8000: loss 0.0001
epoch 10000: loss 0.0000
[0, 0] -> 0.011  target 0
[0, 1] -> 0.994  target 1
[1, 0] -> 0.994  target 1
[1, 1] -> 0.999  target 1

Yes, it learns OR quickly. One neuron would be enough, because one straight line separates (0, 0) from the other three points; the hidden layer is only needed when one line is not enough, as in XOR.

بەڵێ، بە خێرایی OR فێر دەبێت. یەک بەس دەبوو، چونکە یەک هێڵی ڕاست ⁦(0, 0)⁩ لە سێ خاڵەکەی تر جیا دەکاتەوە؛ تەنیا کاتێک پێویستە کە یەک هێڵ بەس نەبێت، وەک لە XORـدا.

Exerciseڕاهێنان7. Read the curves7. چەماوەکان بخوێنەرەوە

Lana trains a CNN on 2,000 photos of Kurdish dishes. After epoch 30 the training loss keeps falling to 0.01, but the validation loss rises from 0.40 to 0.75. What is happening, and what should she do?

لانا لەسەر ⁦2,000⁩ وێنەی خواردنی کوردی ڕادەهێنێت. دوای ⁦30⁩، زیانی ڕاهێنان هەر کەم دەبێتەوە تا ⁦0.01⁩، بەڵام زیانی لە ⁦0.40⁩ـەوە بەرز دەبێتەوە بۆ ⁦0.75⁩. چی ڕوو دەدات و دەبێت چی بکات؟

Show answerوەڵامەکە پیشان بدە

Overfitting: the network is memorising the 2,000 photos. She should keep the weights from about epoch 30 (early stopping), and can add more photos, use dropout or a smaller network. Then she tests once on the test data.

: تۆڕەکە ⁦2,000⁩ وێنەکە لەبەر دەکات. دەبێت لە نزیکەی ⁦30⁩ هەڵبگرێت (ڕاگرتنی زوو) و دەتوانێت وێنەی زیاتر زیاد بکات، dropout یان تۆڕێکی بچووکتر بەکار بهێنێت. پاشان یەک جار لەسەر تاقی دەکاتەوە.

Summaryپوختە

  • An artificial neuron computes f(w1x1+w2x2+⋯+b)f(w_1x_1 + w_2x_2 + \dots + b): inputs times weights, plus a bias, through an activation function (ReLU, sigmoid).
  • Networks have an input layer, hidden layers and an output layer; deep means many layers, each building on the patterns of the one before.
  • Training: forward pass → loss → backpropagation → gradient descent with a learning rate, batch after batch, epoch after epoch; stop when the validation loss rises.
  • One neuron draws one straight line, so XOR needs a hidden layer; our 2-2-1 network learned it in plain Python.
  • CNNs slide small filters over pictures, then pool and classify; RNNs read sequences step by step; transformers use attention and power today's language models.
  • Deep learning took off around 2012 thanks to big data (ImageNet), GPUs and better methods; Hopfield and Hinton received the 2024 Nobel Prize in Physics.
  • ئەمە حیساب دەکات: f(w1x1+w2x2+⋯+b)f(w_1x_1 + w_2x_2 + \dots + b): جاران ، لەگەڵ ، بە ناو (، ).
  • تۆڕەکان ، و هەیە؛ قووڵ واتە چەندین ، کە هەریەکەیان لەسەر شێوازەکانی پێشوو بنیات دەنێت.
  • ڕاهێنان: ← زیان ← ← بە ، کۆمەڵە لە دوای کۆمەڵە، لە دوای ؛ کاتێک زیانی بەرز دەبێتەوە ڕایبگرە.
  • یەک یەک هێڵی ڕاست دەکێشێت، بۆیە XOR پێویستی بە هەیە؛ تۆڕە ⁦2-2-1⁩ـەکەمان بە Pythonـی سادە فێری بوو.
  • بچووک بەسەر وێنەدا دەخشێنن، پاشان و پۆلێنکردن دەکەن؛ زنجیرە هەنگاو بە هەنگاو دەخوێننەوە؛ بەکار دەهێنن و ئەمڕۆ دەجووڵێنن.
  • نزیکەی ⁦2012⁩ بە هۆی ⁦(ImageNet)⁩، و ڕێگای باشترەوە هەستایەوە؛ Hopfield و Hinton خەڵاتی نۆبڵی فیزیای ⁦2024⁩یان وەرگرت.
Review questionsپرسیارەکانی پێداچوونەوە
Why does a neural network need activation functions?بۆچی تۆڕی دەماری پێویستی بە کردارەکانی چالاککردن هەیە؟

Without them, every layer is a straight-line step and the whole network is one straight line. The activation function bends it, so layers can learn curved patterns such as XOR.

بەبێ ئەوان هەر هەنگاوێکی هێڵییە و هەموو تۆڕەکە یەک هێڵی ڕاستە. دەیچەمێنێتەوە، بۆیە دەتوانن شێوازی چەماوە وەک XOR فێر ببن.

What do backpropagation and gradient descent each do?گەڕاندنەوەی هەڵە بۆ دواوە و دابەزینی گرادیەنت هەریەکەیان چی دەکەن؟

Backpropagation computes how much each weight changed the loss (its slope); gradient descent then moves every weight a small step against that slope.

حیساب دەکات هەر چەندی زیانەکەی گۆڕیوە ()؛ پاشان هەموو هەنگاوێکی بچووک بە پێچەوانەی ئەو دەجووڵێنێت.

What is an epoch?گەڕی ڕاهێنان چییە؟

One full pass over all the training data, so every example has been used once to update the weights.

یەک جار تێپەڕبوونی تەواو بەسەر هەموو ، بە شێوەیەک کە هەموو نموونەیەک یەک جار بۆ نوێکردنەوەی بەکار هاتبێت.

What is an embedding?ئیمبەدینگ چییە؟

A learned list of numbers (a vector) for a token or a word. Words used in similar ways get similar vectors; the Generative AI course explains them in depth.

لیستێکی فێربووی ژمارە () بۆ یان وشەیەک. ئەو وشانەی بە شێوەی لێکچوو بەکار دێن لێکچوو وەردەگرن؛ کۆرسی بە قووڵی ڕوونیان دەکاتەوە.

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.

Appearanceڕووکار

Modeدۆخ
Styleشێواز
Coloursڕەنگەکان

Saved on this device only.تەنیا لەسەر ئەم ئامێرە پاشەکەوت دەکرێت.