How Neural Networks Learn

Foundation Idea

Can an AI learn to predict the price of a house?

Start with one example, one input, and one prediction. Then watch how mistakes become feedback.

Learning The process through which a model improves its predictions using examples from data.
Modern house used as the example for price prediction
House A
Size
1000 sq. ft.
Actual market price
Hidden

One Neuron

Meet an artificial neuron

A neuron is a small adjustable formula. It receives an input, combines it with learned parameters, and produces an output.

Artificial Neuron

A basic computational unit that receives inputs, combines them using learned weights and a bias, and produces an output.

× + = output

Select x, w, or b to see what it means.

Input 1000 sq. ft.
Weight 4.5
Neuron
Predicted Price Rs. 55.0 lakh

Different weights and biases produce different predictions.

Prediction And Error

The network makes a prediction

Actual Price Rs. 60 lakh
Prediction Rs. 55 lakh
Error Rs. 5 lakh
Large error -> Large loss
Small error -> Small loss

Prediction Error

The difference between what the model predicted and what actually happened.

Loss

A numerical measure of how wrong the model's prediction is.

Rhetorical Pause

The model is wrong. How does it learn?

Store only the correct answer
Randomly guess again
Adjust what it has learned

Feedback Loop

How a neural network learns

Training repeats the same cycle many times: predict, compare, send error information backward, adjust, and try again.

Training

The repeated process through which a model learns useful parameter values from data.

Backpropagation

A method for sending information about the prediction error backward through the network to determine what needs adjustment.

Optimizer

The mechanism that updates the model's weights and biases to reduce its error.

Training Example
Make Prediction
Compare With Actual
Calculate Error
Send Error Backward
Adjust Parameters

Watch Training

Watch the model learn

Press train to see repeated corrections. The prediction moves closer to the actual price and the error declines.

Learning does not mean storing one answer. It means adjusting parameters so that predictions improve across examples.

Round 1 Prediction: Rs. 55.0 lakh Error: Rs. 5.0 lakh
Training rounds Error

Training Data

One example is not enough

The model needs many examples to detect useful patterns instead of reacting to one house.

Compact house training example 800 sq. ft. Rs. 45 lakh
Medium house training example 1000 sq. ft. Rs. 60 lakh
Large house training example 1500 sq. ft. Rs. 80 lakh
Larger house training example 1800 sq. ft. Rs. 94 lakh

Training Data

Examples used by a model to learn patterns and adjust its parameters.

Many examples -> Detect patterns -> Adjust parameters -> Improve predictions

Zoom Out

From one neuron to a neural network

More inputs and more neurons let the model learn richer relationships, while the learning loop remains the same.

Neural Network

A collection of interconnected artificial neurons that learns relationships between inputs and outputs.

Hidden Layer

A layer of neurons that learns intermediate patterns from the input data.

Deep Learning

Learning with neural networks containing multiple layers that can discover increasingly complex patterns.

Size Location Bedrooms Age
Predicted Price

Two Modes

Training is different from prediction

Training

  1. Training examples
  2. Prediction
  3. Error
  4. Adjust parameters
  5. Repeat
The model is learning.

Inference

  1. New unseen house
  2. Trained neural network
  3. Predicted price

Using a trained model to make a prediction for new input.

Generalization

Has it learned or memorized?

Our model performs extremely well on the houses it studied. Is it necessarily a good model?

Complete Story

The neural network learning story

Data Predict Compare Measure Error Learn Adjust Repeat
Training = Predict -> Compare -> Learn -> Adjust -> Repeat
After Training New Input -> Trained Neural Network -> Prediction

A neural network learns by making predictions, measuring its errors, and adjusting its parameters so that future predictions become better.