Established 2026  ·  Free Educational Resources for All

Computer & AI · Artificial Intelligence

Machine Learning Explained: How Computers Learn From Data

Traditional software is told exactly what to do. Machine learning software is shown examples and works out the rules for itself. That single shift is what makes modern AI possible.

EDUSAMBAM Editorial Team | 14 min read | Artificial Intelligence
🔊 LISTEN TO THIS ARTICLE
SAVE YOUR EYES • IMPROVE YOUR LISTENING
Listen to the article instead of relying only on continuous screen reading.
Ready to read the article.

In traditional programming, a human writes the exact rules, and the computer applies them to data to produce an answer. Machine learning flips that process: a human supplies examples of data and the correct answers, and the computer works out the rules for itself. That single reversal — rules discovered instead of rules written — is what allows software to handle problems, like recognising a face or translating a sentence, that would be nearly impossible to hand-code rule by rule.

1.From Rules to Learning: What Machine Learning Actually Changes

The clearest way to see the shift is to compare the two approaches side by side, using the same problem: sorting emails into "spam" or "not spam."

Traditional Programming
Rules (written by a human)
+
Data (an email)
Answer (spam or not)
Machine Learning
Data (many emails)
+
Answers (labelled spam or not)
Rules (learned automatically)

In machine learning, this learned set of rules is called a model. Once trained, the model can be given a brand-new, never-seen-before email and use the patterns it learned to predict whether it's spam — without a human ever writing an explicit rule like "contains the word 'free'."

2.The Three Main Types of Machine Learning

Machine learning isn't one single technique — it's a family of approaches, grouped by how the learning happens.

TypeHow It LearnsExample Use
Supervised LearningLearns from labelled examples (input paired with the correct answer)Spam detection, predicting house prices
Unsupervised LearningFinds patterns or groupings in data that has no labelled answersGrouping customers by shopping habits
Reinforcement LearningLearns by trial and error, receiving rewards or penalties for actionsGame-playing AI, robotics

Supervised learning is the most common starting point and the easiest to understand, so the rest of this guide focuses mainly on it.

3.How a Model Actually Learns: A Worked Example

Imagine training a very simple model to predict a house's price based only on its size. The model starts with a basic guess — a straight-line formula: price = (size × weight) + bias — where weight and bias are numbers the model doesn't yet know the right value for.

Size (m²)Actual Price
50$150,000
80$230,000
120$340,000

Training happens in a loop: the model makes a prediction using its current weight and bias, compares that prediction to the actual price to calculate an error (also called loss), and then slightly adjusts the weight and bias to make the error a little smaller. This loop, called gradient descent, repeats thousands of times until the predictions become as accurate as the model can make them.

Python — Simplified Training Loop
weight = 0.0
bias = 0.0
learning_rate = 0.0001

for epoch in range(1000):
    for size, actual_price in training_data:
        prediction = (size * weight) + bias
        error = actual_price - prediction
        # nudge weight and bias to reduce the error
        weight += learning_rate * error * size
        bias   += learning_rate * error

Each pass through all the training data is called an epoch. By the end of training, weight and bias have settled on values that let the formula predict prices reasonably well for houses it has never seen before — this is the entire "learning" in machine learning: adjusting numbers until error is minimised.

Key Idea

A trained model is really just a set of numbers (weights) that have been carefully tuned. "Training" a model and "running" a trained model are two very different processes — training can take enormous amounts of computing time, while using an already-trained model to make a single prediction is usually fast.

4.Neural Networks: A Brief Look Under the Hood

The house-price example used one simple formula. Many modern machine learning systems instead use neural networks — models loosely inspired by neurons in the brain, built from layers of connected units, or nodes. Data enters through an input layer, passes through one or more hidden layers that combine and transform it, and produces a result at the output layer.

Input Layer
Hidden Layer
Hidden Layer
Output

Each connection between nodes has its own weight, adjusted during training the same way as the simple house-price example — just with millions or billions of weights instead of two. A network with many hidden layers is what gives deep learning its name, and this layered structure is what allows models to learn far more complex patterns than a single straight-line formula could, such as recognising objects in photos or generating natural-sounding text.

1958
The Perceptron, an early single-layer neural network, is built — one of the first working models of machine learning.
1986
Backpropagation is popularised as an efficient way to train multi-layer networks, making deeper networks practical.
2012
A deep neural network called AlexNet dramatically outperforms previous methods at image recognition, sparking the modern deep learning boom.
2017–Present
The Transformer architecture enables today's large language models, powering modern AI chatbots and generative AI tools.

5.Where Machine Learning Shows Up in Daily Life

Real-World Example

A streaming service's "recommended for you" list is generated by a model trained on millions of users' viewing histories, learning patterns like which shows tend to be watched by similar audiences — without any human writing a rule for every possible combination of shows and viewers.

Beyond recommendations, machine learning also powers voice assistants converting speech to text, banks flagging potentially fraudulent transactions, email spam filters, photo apps recognising faces, and the autocomplete suggestions in a search bar.

6.Limitations Worth Understanding

Machine learning is powerful, but it isn't magic, and it inherits problems from wherever its training data came from.

7.How to Start Learning Machine Learning

A Closing Thought

Every impressive machine learning system, no matter how advanced, is built from the same core loop covered here: make a prediction, measure the error, adjust the numbers, repeat. What changes between a simple house-price predictor and a state-of-the-art AI system is mostly scale — more data, more layers, more computing power — not a fundamentally different idea. Understanding this loop is the foundation for understanding everything else in modern AI.

Test Your Understanding

Practice Quiz

10 questions. Select an answer for each, then submit to see your score instantly.

0 of 10 answered
0/10
You scored 0%
Keep practicing
1.What is the key difference between traditional programming and machine learning?
2.In machine learning, what is a "model"?
3.Which type of machine learning learns from labelled examples (input paired with the correct answer)?
4.What does "error" or "loss" measure during training?
5.What is an "epoch" in training a model?
6.In a neural network, what is the "hidden layer"?
7.What gives "deep learning" its name?
8.What is "overfitting"?
9.Why can a model learn unfair or biased patterns?
10.According to the article, what is a sensible first step toward learning machine learning?
← Previous: What is Artificial Intelligence?GatewayNext: What Is a Large Language Model? →