Skip to content
MAMasterAI Now
2 / 1113 min de lectureNiveau: Beginner5 fiches

Le neurone artificiel

Une somme pondérée plus une courbure : une machine à décider.

⚠ Cette étape est traduite à 2% en Français ; les fiches restantes restent en anglais. Une erreur repérée ? Les corrections de traduction sont bienvenues.

Progression de lecture0%
Card 1 — from number to decisionFiche 1 sur 5

A straight line gives a number. A neuron gives an answer.

Glue a step onto the end of a regression and you can say yes or no.

Linear regression outputs any number at all. Most useful questions are yes/no instead: is this email spam, is this scan suspicious, should the car brake? To answer those we glue a step onto the end of the line.

Analogy
Dimmer switch, light switch

A regression output is a dimmer: it slides smoothly. A decision is a light switch: on or off. A neuron is a dimmer wired into a light switch — it computes a smooth value, then snaps it.

z = w₁x₁ + w₂x₂ + … + wₙxₙ + b → output = f(z)
z is the weighted sum (the pre-activation). f is the non-linear activation function.

Weighted sum, then non-linearity — that is the atom of every neural network in existence. Stack millions of them and you get GPT. The atom itself never changes.

Un contrôle rapide avant la fiche suivante

What is the essential difference between linear regression and a single neuron?

5 contrôles

🔒

Laboratoire verrouillé

Terminez les 5 fiches et leurs contrôles pour débloquer cette simulation.

Read the full stage transcript (all 5 cards, no JavaScript required)
Card 1 — from number to decision

1. A straight line gives a number. A neuron gives an answer.

Glue a step onto the end of a regression and you can say yes or no.

Linear regression outputs any number at all. Most useful questions are yes/no instead: is this email spam, is this scan suspicious, should the car brake? To answer those we glue a step onto the end of the line.

Analogy
Dimmer switch, light switch

A regression output is a dimmer: it slides smoothly. A decision is a light switch: on or off. A neuron is a dimmer wired into a light switch — it computes a smooth value, then snaps it.

z = w₁x₁ + w₂x₂ + … + wₙxₙ + b → output = f(z)
z is the weighted sum (the pre-activation). f is the non-linear activation function.

Weighted sum, then non-linearity — that is the atom of every neural network in existence. Stack millions of them and you get GPT. The atom itself never changes.

Knowledge check: What is the essential difference between linear regression and a single neuron?

  • a. A neuron has more inputs
  • b. A neuron applies a non-linear activation to the weighted sum← correct
  • c. A neuron has no weights

Without the non-linearity a neuron is just a straight line in disguise. The bend is what makes decisions — and deep learning — possible.

Card 2 — the threshold

2. The bias is a firing threshold

Bias is not extra paperwork. It decides when the neuron fires at all.

In z = Σwᵢxᵢ + b, the bias shifts the decision boundary away from the origin. Think of a smoke detector: it does not alarm on the first smoked particle, it waits for the signal to cross a threshold. The bias sets that threshold.

Analogy
The exam pass mark

The weighted sum is a raw exam score. The bias is the pass mark. Move the pass mark and you change who graduates, even though nobody answered differently.

  • Large negative bias → needs strong evidence before firing (conservative neuron).
  • Large positive bias → fires easily (trigger-happy neuron).
  • No bias at all → every decision boundary is forced through the origin, a needless restriction.

Knowledge check: You remove the bias term from every neuron in a network. What breaks?

  • a. Nothing, bias is cosmetic
  • b. Every decision boundary is forced through the origin← correct
  • c. Gradients can no longer be computed

Bias gives each neuron a free offset. Without it all decision surfaces are anchored at the origin, costing real expressive power.

Card 3 — the bend

3. Pick your activation function

The bend decides how, and whether, your network learns.

ActivationShapeRangeWhere you meet it
StepHard on/off0 or 11958 perceptron — not trainable by gradients
SigmoidSmooth S-curve0 to 1Binary classification output layers
TanhS-curve centred at 0−1 to 1Classic RNN hidden states
ReLUFlat below 0, linear above0 to ∞Default of most deep networks
GELU / SiLUSmooth ReLU≈ −0.17 to ∞Transformers, including every modern LLM

The step function looks perfect for decisions, but its gradient is zero everywhere, so gradient descent has nothing to follow. The 1958-era fix was to smooth the step: the sigmoid σ(z) = 1/(1+e⁻ᶻ) is a differentiable ramp from 0 to 1.

Watch outThe vanishing gradient

Sigmoid squashes everything into a narrow band, so its gradient never exceeds 0.25. Stack ten such layers and the gradient is multiplied down to ~10⁻⁶ — the signal dies. ReLU fixed this with a gradient of exactly 1 for positive inputs. That single change is why deep networks became trainable around 2011.

σ(z) = 1 / (1 + e⁻ᶻ) ReLU(z) = max(0, z)
Sigmoid output reads as a probability. ReLU output is an unbounded activation.

Knowledge check: Why did ReLU largely replace sigmoid in hidden layers?

  • a. It is more mathematically elegant
  • b. Its gradient is 1 for positive inputs, so gradients do not vanish with depth← correct
  • c. It outputs a probability directly

Sigmoid gradients are ≤ 0.25 and shrink multiplicatively per layer. ReLU passes gradient through unchanged for active units, enabling deep stacks.

Card 4 — the famous failure

4. One neuron can learn AND and OR, but never XOR

The most consequential dead end in AI history.

A single neuron draws one straight decision boundary. AND and OR are linearly separable: a single line cuts them cleanly. XOR is not — no straight line can separate its positives from its negatives.

x₁x₂ANDORXOR
00000
01011
10011
11110
Analogy
Two guards, one bouncer

Neuron A learns OR. Neuron B learns AND. A third neuron combines them: fire if A fired AND B did not. XOR solved. Discovered in 1969 that a single layer cannot do this, research funding dried up — the first "AI winter".

The fix is the Multi-Layer Perceptron: stack neurons into layers. Stacking only helps because of the activation function from Card 3 — compose two linear functions and you get another linear function, but compose two ReLUs and you get a bendable piecewise surface that can carve out any shape.

Knowledge check: Why can a single perceptron never learn XOR?

  • a. XOR has too many inputs
  • b. XOR is not linearly separable and one neuron draws only one straight boundary← correct
  • c. The learning rate is too small

One neuron = one hyperplane. XOR needs two boundaries, hence two neurons plus a combining layer.

Card 5 — the recipe

5. A neuron from scratch, and why layers are matrices

Every layer of every modern network is this function, vectorised.

ts
type Neuron = { weights: number[]; bias: number };

const relu = (z: number) => Math.max(0, z);

export function forward(neuron: Neuron, inputs: number[], activate = relu): number {
  if (inputs.length !== neuron.weights.length) {
    throw new Error('shape mismatch: one weight per input');
  }
  let z = neuron.bias;
  for (let i = 0; i < inputs.length; i++) {
    z += neuron.weights[i]! * inputs[i]!;
  }
  return activate(z);
}

A layer is many neurons reading the same inputs. Arrange the weights as a matrix and the loop becomes a single matrix multiply: Z = X·W + b. This is exactly the operation GPUs were built to accelerate — millions of tiny weighted sums per millisecond.

  • Inputs → weights → sum → bias → activation → output.
  • The same five-step shape repeats in every layer of every modern network.
  • Weights are learned; the activation function is a design choice you make.
  • Non-linearity between layers is what makes depth pay off.
NoteNext up

Your neurons now exist but start random and clueless. Stage 3 explains the algorithm that assigns blame to each individual weight across many layers: backpropagation.

Knowledge check: What does backpropagation need from an activation function?

  • a. That it is differentiable, so the chain rule can flow through it← correct
  • b. That its output is exactly 0 or 1
  • c. That it has no parameters

Backprop multiplies local derivatives across layers. A non-differentiable activation such as the hard step breaks that chain entirely.