What Is Machine Learning?
A middle-school guide to machine learning: training data, features, models, neural networks, supervised vs unsupervised learning, overfitting and bias.
Key takeaways
- Machine learning builds a model that learns patterns from data instead of being given explicit rules
- Supervised learning uses labelled examples; unsupervised learning finds structure in unlabelled data
- Neural networks are layers of simple connected units whose weights adjust during training
- Models can overfit, inherit bias from data, and must be tested on new, unseen data
From rules to learning
In ordinary programming, a person writes the rules. To detect spam email, you might code: "If the message contains 'free prize', flag it." But spammers change their words constantly, so hand-written rules quickly break.
Machine learning (ML) flips this around. Instead of writing the rules, you give the computer data and let it learn the rules itself. If you are new to the idea, start with How Does AI Learn?.
The key pieces
Three words matter most:
- Data — the examples, such as thousands of emails labelled "spam" or "not spam."
- Features — the measurable details the model looks at, like which words appear, the time sent, or the sender.
- Model — the system that learns the relationship between the features and the answer. Once trained, the model makes predictions on new inputs it has never seen.
Training is the process of adjusting the model so its predictions get closer to the correct answers in the data.
Two main styles of learning
Supervised learning uses labelled data. Each example comes with the correct answer. The model learns to map inputs to outputs. Spam detection, predicting house prices, and recognising handwriting are all supervised tasks.
Unsupervised learning uses data with no labels. The model looks for structure on its own, such as grouping customers into clusters with similar habits. Nobody told it the groups in advance; it discovered them.
There is also reinforcement learning, where an agent learns by trial and error, earning rewards for good actions, like an AI learning to play a game.
Neural networks
A neural network is a popular kind of model, loosely inspired by brain cells.
It is made of simple units arranged in layers. Each connection between units has a weight, a number. An input flows in, gets multiplied by weights, passes through many layers, and produces an output.
At first the weights are random, so the output is wrong. During training, the network compares its output to the correct answer and nudges the weights to reduce the error. Repeat this millions of times and the weights settle into values that make good predictions. Networks with many layers are called deep learning, and they power image recognition and chatbots.
When learning goes wrong
ML is powerful but not magic. Two big problems:
Overfitting. If a model memorises the training data too closely, including random noise, it does great on those exact examples but fails on new data. To catch this, we always test the model on data it has never seen, called a test set.
Bias. A model reflects its data. If the training data is unbalanced or carries human prejudice, the model repeats and can even amplify it. For example, a hiring model trained on biased past decisions may keep making unfair ones. Good ML work means checking data for fairness and testing results across different groups.
Why it matters
Machine learning sits behind search engines, recommendations, medical image tools, translation and self-driving research. Understanding it helps you use these tools wisely and question them when they get things wrong.
Next, see how these ideas scale up in How Chatbots and Language Models Work. If you want to build models yourself, strengthen your Coding skills first, especially Python.
Quick quiz
Test yourself and earn XP
What is a 'model' in machine learning?
A model is the system that the learning algorithm builds from the training data; it makes predictions on new inputs.
What is the main difference between supervised and unsupervised learning?
Supervised learning trains on labelled examples (input plus correct answer). Unsupervised learning finds structure in data with no labels.
What are the 'weights' in a neural network?
Weights are numbers on the connections between units. Training adjusts them so the network's output gets closer to the correct answer.
What does it mean when a model 'overfits'?
Overfitting means the model learned the training examples too closely, including noise, so it fails to generalise to new data.
Why can a machine learning model be biased?
A model reflects its training data. If the data is unbalanced or contains human bias, the model can repeat or amplify that bias.
FAQ
To use ML tools, basic algebra and curiosity are enough. To build models deeply, you will later want statistics, linear algebra and some calculus.
Machine learning is one part of AI. It is the most successful approach today, but AI is a broader field that also includes other techniques.
Keep exploring
More in AI