Learning from examples instead of fixed rules
Imagine teaching a child to recognize mangoes. You probably would not begin with a hundred exact rules about color, shape, texture, size, and lighting. You would show several mangoes and point out the correct answer.
Example mango + correct name
Example mango + correct name
Example mango + correct name
↓
The learner notices useful similarities
Machine Learning uses a related idea. We give a computer examples or experience, and a learning algorithm adjusts a model so that it becomes better at a measurable task.
The comparison is limited: a human child understands the world in ways the model does not. The model changes numbers to capture statistical relationships.
The three stages of Machine Learning
Stage 1: collect examples
For an email filter, an example may contain:
Email: "You won a free prize!"
Correct label: spam
The email is data. spam is the answer we want the model to learn to predict.
Stage 2: train
The model guesses. Training software compares the guess with the correct answer and adjusts the model’s internal numbers.
guess → check → measure error → adjust → try again
Stage 3: use the trained model
Later, a new email arrives without a provided answer. The trained model predicts spam or not spam. Using a trained model this way is called inference.
Key terms
- Example: One item the learning process can examine.
- Label: The correct category attached to a training example.
- Training: The process that adjusts a model using data.
- Parameter: An adjustable number inside the model.
- Inference: Using the trained model on new input.
Check your understanding
Does the programmer write the exact rule for every spam sentence? Usually no. The learning process finds statistical patterns from many examples.
Does the model become correct forever after training? No. New scams, different users, and poor-quality data can cause mistakes, so the system must be evaluated and monitored.
Think about how you learned to recognize a dog as a kid. Nobody handed you a rulebook that said “four legs, fur, a snout of length X, ears of shape Y.” Instead, someone pointed at dogs — lots of different dogs, in different sizes and colors and poses — and said “dog” each time. Eventually, without anyone writing down a formal definition, you just got it. Show you a breed you’ve never seen before, and you’d still say “dog” with confidence.
Machine Learning is the field of getting computers to do the same thing: learn a pattern from examples, rather than being handed an explicit set of instructions for it.
The simple definition
Machine Learning is a way of building software where, instead of a programmer writing the exact rules, the computer figures out the rules itself by studying a lot of examples.
In the Artificial Intelligence article, we drew a distinction between the “rules written by a human” approach and the “system learns rules from data” approach. Machine Learning is that second approach, made concrete. If AI is the overall goal (build machines that act intelligently), Machine Learning is the dominant modern method for reaching that goal.
Why does Machine Learning exist?
Traditional programming works by a human anticipating every case and writing a rule for it. That falls apart the moment a task is too fuzzy, too variable, or too large to fully specify by hand.
Take email spam detection. You could try to write rules: “if the email contains the word ‘lottery,’ mark it spam.” But spammers adapt instantly — they’ll misspell it “l0ttery” tomorrow. You’d be rewriting rules forever, always one step behind. What actually works is showing a system millions of real emails, labeled spam or not-spam, and letting it discover the statistical patterns that separate the two — patterns far more subtle and numerous than any human would think to write down, and patterns that can be re-learned as spam evolves.
That’s the problem ML solves: tasks where the pattern exists, but it’s too complex, too high-dimensional, or too fast-changing for a human to write down as fixed rules.
What would happen without it
Without ML, we’d be stuck maintaining enormous, brittle rulebooks for every pattern-recognition task — image recognition, speech recognition, translation, fraud detection — each one falling out of date the moment the real world shifted slightly. Many things you rely on daily simply wouldn’t be practically possible.
The core loop: training and inference
Here’s the mechanical heart of Machine Learning, and once this clicks, everything else in this glossary builds on top of it.
An ML system, often called a model, starts out knowing nothing useful. It has internal, adjustable numbers called parameters (sometimes called weights) which begin essentially random. The model is then shown examples from a dataset — often thousands or millions of them.
For each example, the model makes a guess, compares that guess to the correct answer, and nudges its internal parameters slightly in the direction that would have made the guess more correct. Repeat this over the entire dataset, many times over, and those parameters slowly settle into values that capture the real underlying pattern. This whole process is called training.
flowchart LR
A[Training Data + Correct Answers] --> B[Model makes a guess]
B --> C[Compare guess to correct answer]
C --> D[Adjust internal parameters slightly]
D --> B
D --> E[Trained Model]
Once training is done, the model’s parameters are locked in (for now), and it’s ready to be used on brand-new data it’s never seen — a phase called inference. This is the moment you actually interact with the model: you give it an email, and it tells you spam or not-spam; you give it a photo, and it tells you what’s in it.
Training happens once (or periodically, when you want to update the model). Inference happens every single time someone actually uses the model. This distinction matters a lot in practice — training is expensive and slow, done by engineers ahead of time; inference needs to be fast, because it’s happening live, potentially thousands of times a second.
ANALOGY vs. TECHNICAL REALITY
Analogy: Think of training a model like a student studying for an exam using thousands of practice questions with answer keys. At first they guess badly. Each time they check their answer against the key and adjust their understanding slightly. After enough practice questions, they can handle a brand-new question on the actual exam that wasn’t in the practice set.
Where this breaks down: A student adjusts their understanding through conscious reasoning — “oh, I see why I got that wrong.” A model doesn’t reason at all. It adjusts numerical parameters through a precise mathematical procedure (an algorithm called gradient descent, which you don’t need to master here) that mechanically reduces its error, sentence by sentence, example by example, with no comprehension involved. The results can look like understanding, but the mechanism underneath is pure math on numbers, not thought.
What “learning” actually means, technically
It’s worth being blunt here because this is where beginners often drift into vague language. A trained model is not a set of if/then rules, and it’s not “storing” the training examples either. A trained model is a large collection of numbers (parameters) arranged in a specific mathematical structure, tuned so that when you feed in new input, the resulting calculations produce a useful output — a predicted category, a predicted number, or in more advanced systems, generated text or images.
“Learning,” here, precisely means: adjusting those parameters based on data until the model’s outputs get closer to the correct answers. Nothing more mystical than that — though, as you’ll see in later articles on Deep Learning and Neural Networks, the structures these parameters live in can get extremely elaborate.
Types of Machine Learning
Not all ML problems look the same, so the field splits into a few major categories based on what kind of data and feedback the model gets during training.
Supervised Learning — the model learns from examples that already have the correct answer attached (labeled data). Spam detection is supervised: every training email is pre-labeled “spam” or “not spam.” This is the most common and most intuitive category, and it splits further into:
- Classification — predicting a category (spam vs. not-spam, cat vs. dog vs. bird).
- Regression — predicting a number (predicting a house’s price, predicting tomorrow’s temperature).
Unsupervised Learning — the model is given data with no correct answers attached, and has to find structure on its own — like grouping customers into clusters based on purchasing behavior, without being told in advance what the groups should be.
Reinforcement Learning — the model (often called an agent) learns by taking actions in an environment and receiving rewards or penalties, gradually learning which actions lead to better outcomes. This is how systems learn to play games at a superhuman level, or how a robot learns to walk — through trial, error, and reward, not labeled examples.
You don’t need to memorize all of this deeply right now — just recognize that “Machine Learning” is an umbrella covering these different learning setups, chosen based on what kind of data and feedback is available for the problem at hand.
Where you’ll actually encounter this
- Netflix or Spotify recommendations — a supervised or hybrid model trained on what similar users watched or listened to next.
- Credit card fraud detection — a classification model trained on millions of past transactions labeled fraudulent or legitimate.
- Weather forecasting models — regression models trained on historical weather data to predict tomorrow’s temperature or rainfall.
- A photo app grouping your pictures by person — an unsupervised clustering approach on facial features, often refined with some supervised signal.
- A chess or Go engine that improved by playing itself millions of times — reinforcement learning.
An engineer building any of these doesn’t hand-code the decision logic. They gather good data, choose an appropriate model type, train it, measure how well it performs on data it hasn’t seen before, and adjust — a cycle that’s more like coaching than programming in the traditional sense.
Advantages and limitations
ML shines when there’s a genuine pattern to be found, and enough good-quality data to reveal it. It scales to problems too complex or too fast-changing for manual rules, and it can improve over time as more data becomes available.
Its limitations are just as important to internalize early. A model is only as good as its training data — if the data is biased, incomplete, or unrepresentative, the model’s “learned pattern” will reproduce those same flaws, often invisibly. Models also generally can’t explain their reasoning the way a rule-based system can (this is sometimes called the “black box” problem).
And a model trained on one kind of data can perform badly on data that looks meaningfully different from what it was trained on — a phenomenon worth remembering the first time a model that worked great in testing suddenly performs oddly in the real world.
A common misconception
People sometimes assume a trained ML model “understands” the task the way a person does — that a spam filter knows what spam is, conceptually. It doesn’t. It has learned a statistical association between certain input patterns and the “spam” label, based on the exact data it was shown. Feed it something wildly different from its training data — a new kind of scam nobody had seen when the model was trained — and it may fail in ways a human wouldn’t, because it never possessed real comprehension in the first place, only a pattern shaped by past examples.
The reusable mental model: examples change the rule
In ordinary programming, a person writes the rule. In Machine Learning, a training process adjusts a model until its predictions better match examples.
Traditional programming
Data + human-written rules ──► answers
Machine Learning training
Data + correct examples ──► learning algorithm ──► trained model
Machine Learning inference
New input + trained model ──► prediction
Training creates or adjusts the model. Inference uses the trained model. Keeping those two stages separate prevents many beginner misunderstandings.
A tiny worked example
Imagine examples of houses with their sizes and selling prices:
| House size | Actual price |
|---|---|
| 500 sq ft | ₹25 lakh |
| 1,000 sq ft | ₹50 lakh |
| 1,500 sq ft | ₹75 lakh |
A simple model might discover the approximate pattern:
predicted price = house size × ₹5,000 per sq ft
For a new 1,200-square-foot house:
1,200 × ₹5,000 = ₹60,00,000 = ₹60 lakh
Real prices depend on location, age, condition, and many other features, so this one-feature model is deliberately simple. It demonstrates the learning idea without pretending that a toy example is production-ready.
What changes internally during learning?
- The model begins with adjustable numbers called parameters.
- It makes predictions for training examples.
- A loss function measures how far those predictions are from the correct answers.
- An optimization algorithm changes the parameters to reduce that loss.
- The cycle repeats many times.
- The finished model is tested on examples it did not train on.
flowchart LR
A[Training examples] --> B[Model predicts]
B --> C[Measure error with loss]
C --> D[Adjust parameters]
D --> B
B --> E[Test on unseen data]
Learning therefore does not mean that the computer becomes conscious. It means that numerical parameters are adjusted using evidence from data.
A minimal Python example
from sklearn.linear_model import LinearRegression
# Each inner list is one house with one feature: size in square feet.
training_inputs = [[500], [1000], [1500]]
correct_prices = [2_500_000, 5_000_000, 7_500_000]
model = LinearRegression()
model.fit(training_inputs, correct_prices) # Training
prediction = model.predict([[1200]]) # Inference
print(f"Predicted price: ₹{prediction[0]:,.0f}")
fit(...) finds parameter values from the examples. predict(...) applies those learned values to a new input. A production project would use more representative data, separate training and test sets, validate data quality, and monitor errors after deployment.
When Machine Learning is the wrong tool
Do not reach for ML merely because it sounds advanced. Prefer explicit rules when the logic is stable, complete, and must be exact—for example, calculating tax from an approved formula or rejecting a password shorter than a required length.
Machine Learning is most useful when the rule is hard to write but examples and measurable outcomes exist. It is risky when data is scarce, biased, illegally collected, unrelated to the future, or when an unexplained mistake can cause unacceptable harm.
Production checklist
- Start with a simple baseline before a complex model.
- Separate training, validation, and test data correctly.
- Compare the right metric, not merely accuracy.
- Check whether performance differs across important groups.
- Monitor changing data, latency, cost, and failures after deployment.
- Keep a safe fallback or human-review path for high-impact decisions.
The complete learning chain
examples in a dataset
↓
training algorithm compares predictions with answers
↓
model parameters change
↓
trained model
↓
new input produces a prediction during inference
A spam filter learns from labeled emails. A recommendation model learns from interactions such as views and purchases. A large language model learns statistical patterns that help it predict the next token. The applications differ, but the central idea remains the same: examples influence the rule instead of a programmer writing every rule by hand.
Where this fits in what comes next
Machine Learning is the general method; the next articles narrow in on how that method has evolved and specialized. Deep Learning is a particular, extremely powerful family of ML techniques built around structures called Neural Networks, loosely inspired by how neurons connect in the brain. Almost every headline-making AI system you’ve heard of recently — including the models behind Generative AI and Large Language Models — is a Deep Learning system underneath. Understanding the training/inference loop and the idea of learned parameters, as covered here, is the foundation that all of those build directly on top of.
In one sentence
Machine Learning replaces hand-written rules with a training process that lets a model discover its own rules from data — and virtually everything exciting in modern AI is a more sophisticated variation on that same basic loop.
Related Terms
- Author
- TechByteByByte Editorial Team
- Reviewed by
- TechByteByByte Admin
- Published
- Last reviewed