Aurorisk FR

Chapter 1 · Lesson 1.3

Machine learning

The statistical model builds itself from a dataset.

The principle of learning

  1. Training data → learning process → model.
  2. Use : data in → model → answer.

The structure of the model (the general form of the equations) is the heart of the approach. The downside: with a complex model, it is harder to interpret the “why” of a result.

Vocabulary: Russian dolls

  • Artificial intelligence (AI) : anything that relates to intelligence made by humans and exhibited by machines.
  • Machine learning (ML) : an approach to achieve AI.
  • Deep learning (DL) : a technique to implement ML (deep neural networks).
  • The LLMs rely on deep learning.

Types of learning

TypePrincipleExamples
SupervisedData labelled : the correct answer is provided.Classification (spam / not spam), regression (price of a property)
UnsupervisedUnlabelled data: the system discovers structures.Clustering (similar customers), dimensionality reduction
Semi-supervisedA small part labelled, a large part not.—
ReinforcementTrial and error, rewards and penalties.Video games, autonomous robots

Model vocabulary

Try it: underfitting and overfitting

A model that is too simple misses the shape of the data; a model that is too flexible “memorises” the noise. Vary the degree of the model and the noise, then compare the error on the training points and on the test points.

Going further: training, validation and test sets

To know whether a model generalises, it is judged on data it has never seen during training. The data is therefore split into three: training (to fit the parameters), validation (to choose the settings: model complexity, network size…) and test (final measurement, used only once). If the model is tuned by looking at the test set, the latter is no longer independent and the reported performance becomes too optimistic.

In general, the training error always falls as the model becomes more complex, whereas the test error eventually rises: this is the signature of overfitting.

The trade-off bias–variance formalises this phenomenon: the expected error breaks down into bias² (model too rigid) + variance (model too sensitive to the training sample) + irreducible noise. With little data, settings are compared by k-fold cross-validation : each fold serves in turn as validation and the k scores are averaged.

The neural network in pictures

A neural network is an assembly of small computing units, the artificial neurons, organised in couches.

An artificial neuronThree weighted inputs are summed with a bias, then pass through an activation function that gives the output. w₁w₂w₃ x₁x₂x₃ Σ b f(z) y InputsWeightsWeighted sumActivationOutput biais
A neuron : it computes z = w₁x₁ + w₂x₂ + w₃x₃ + b, then applies an activation function f (sigmoid, ReLU…): y = f(z). These are the poids w and the bias b that training adjusts.
A layered neural networkAn input layer of three neurons, two hidden layers of four neurons and an output layer of two neurons, each neuron being connected to all those in the next layer.Input layerHidden layer 1Hidden layer 2Output layer
A layered network : each circle is a neuron, each line carries a weight. Data enters on the left, passes through the hidden layers and comes out on the right (here two possible classes). With many hidden layers, we speak of a “deep” network (deep learning).

Try it: from neuron to network

1. A neuron. Weighted sum of the inputs + bias, then activation function. The poids are what training adjusts.

2. A network that learns. With 0 hidden neurons (a single neuron) the boundary is a straight line; with a hidden layer, the network combines several lines and can draw shapes (XOR, circle, spiral). Try: XOR with H = 0, then H = 4; the spiral with H = 16; lower or raise the learning rate ; enable L2 regularisation and compare training and test accuracy (overfitting).

Key takeaway

Learning = finding weights that lower the error (the loss) on the training examples, through small successive corrections (gradient descent). A larger network learns more complex shapes, but risks “sticking” to the training data.

Going further: gradient descent in one formula

At each step, each weight is corrected in the direction that lowers the loss L: w ← w − η · ∂L/∂w, where η is the learning rate. If it is too large, the corrections “jump” over the minimum and training diverges; if it is too small, convergence is slow. The backpropagation computes all the derivatives ∂L/∂w layer by layer, applying the chain rule from the output towards the input.

Numerical example: with w = 0.8, ∂L/∂w = 0.5 and η = 0.1, the new weight is 0.8 − 0.1 × 0.5 = 0.75.

Try it: gradient descent

A ball rolls along the loss curve: at each step, it moves back by a distance proportional to the slope. Vary the learning rate and the starting point, then try the two-valley landscape.