Try writing the rule for "is this email spam?" Block anything with the word "free"? You just blocked your friend's message about free samosas in the canteen. Block anything in capitals? Your aunt writes in capitals. And spammers change tactics every week, so every rule you write is out of date before you ship it.
Now try a different approach. Take a hundred thousand emails people already marked spam or not, hand them to an algorithm, and let it find the pattern. That is machine learning — and this lesson is about what that actually means, the words you need, and the more important half: when not to reach for it.
The flip
Memorise this sentence, because it is the cleanest answer to a question you will certainly be asked: traditional programming takes rules and data and produces answers; machine learning takes data and answers and produces the rules.
Everything else follows from that flip. You need answers — examples where you already know what was correct. You get rules — and they are found, not written, so nobody can point at a line of code and say "this is why". And because they came from your examples, they are only as good as your examples were.
The vocabulary you need
| Term | Means | In a rent-prediction table |
|---|---|---|
| Feature | an input the model uses | area, bedrooms, distance to metro |
| Target / label | what you are predicting | the rent |
| Instance / sample | one example | one flat |
| Training | the process of finding the rules | fitting on 8,000 past listings |
| Model | the learned rules | the thing you call .predict() on |
| Prediction / inference | using the model on new data | rent for a flat listed today |
Two of those get confused constantly, so be precise: features are in, target is out. And "model" means the trained artefact, not the algorithm — linear regression is an algorithm, the fitted coefficients are a model.
AI, ML and deep learning
Three nested circles, asked as a warm-up question in a lot of rounds:
- Artificial intelligence — the broad goal of getting machines to do things that seem intelligent. Includes ML, and also includes things that aren't ML at all, like a chess engine searching moves.
- Machine learning — the approach of learning patterns from data rather than being programmed with rules.
- Deep learning — machine learning using multi-layer neural networks. Excellent on images, audio and text; usually not the best choice for ordinary tables (lesson 9).
So: AI ⊃ ML ⊃ deep learning. And LLMs sit inside deep learning, which is why the GenAI course is a branch of this tree rather than a replacement for it.
When ML is the right tool
Four conditions. You want most of them present:
- A pattern exists that is genuinely there but too complex to write down.
- You have data — and for supervised learning, labelled data, meaning examples where the right answer is known.
- The rules can't be written by hand, either because there are too many or because they keep changing.
- Being occasionally wrong is acceptable. Every model makes mistakes. If a single error is catastrophic and unrecoverable, think hard.
💡 Condition 3 has a sharper version worth remembering: adversarial problems — fraud, spam, abuse — are the strongest ML cases of all, because the opponent adapts. Hand-written rules go stale by design there, which is an argument no static rule can answer.
Wait — when should I NOT use ML?
This half gets asked more often than people expect, because a candidate who applies ML to everything is a liability.
| Situation | Why not |
|---|---|
| A known, exact rule exists (GST, PF contribution, password check) | write the rule — it's faster, exact, and auditable |
| No labelled data and no way to get it | supervised learning is off the table regardless of budget |
| Every decision must be fully explainable by law | possible, but it constrains you to simple models — decide that up front |
| A single mistake is catastrophic | models are wrong sometimes; the system needs a human or a fallback |
| A simple heuristic already works | a model that beats it by 1% still costs you a system to maintain forever |
"We tried a one-line rule first and it was good enough" is a better engineering answer than any model. It is also, in interviews, a much rarer one.
Generalisation: the whole point
Here is the idea everything else in this course rests on.
A model that scores 100% on the data it trained on has proved nothing — it may simply have memorised it, the way you could memorise the answers to last year's paper without understanding the subject. What you need is generalisation: performing well on data it has never seen.
Which is why every ML workflow splits the data:
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42)
model.fit(X_train, y_train) # learn from 80%
score = model.score(X_test, y_test) # judge on the untouched 20%Result
The test score is the one you report. A large gap between the two has a name — overfitting — and lesson 5 is entirely about it.
The accuracy trap
One scenario comes up in interviews so often it deserves its own section here, before you ever meet a metric formally.
A model predicts loan defaults with 99% accuracy. Impressive? Only 1% of applicants default. So a model that predicts "no default" for every single person also scores 99% — and catches zero defaulters.
On imbalanced data, accuracy is close to meaningless. The same trap sits under fraud detection, disease screening, churn and equipment failure — anything where the interesting class is rare. Lesson 6 gives you the metrics that don't lie here; for now, just develop the reflex: ask what proportion of the data is the positive class before believing any accuracy figure.
🎯 Selection-round radar: "What is machine learning?" is a near-certain opener. Give the flip — rules and data in versus data and answers in — then add the sentence that separates you: "and I'd only use it where a rule can't be written; for something like GST calculation a rule is faster, exact and auditable."
Common mistakes
- Applying ML to problems with a known exact rule.
- Reporting the training score instead of the test score.
- Quoting accuracy on heavily imbalanced data.
- Confusing features (inputs) with the target (output).
- Saying "AI" and "ML" interchangeably in an interview.
- Starting a project with no baseline to compare against.
Quick recap
| Concept | One-liner |
|---|---|
| The definition | data + answers in, rules out — the reverse of programming |
| Features / target | inputs / what you predict |
| AI ⊃ ML ⊃ DL | nested; LLMs sit inside deep learning |
| Use ML when | a pattern exists, data exists, rules can't be written, errors are survivable |
| Don't use ML when | an exact rule exists, or a simple heuristic already works |
| Generalisation | the goal — always judge on held-out data |
| Accuracy trap | on imbalanced data, 99% can mean catching nothing |
Practice Zone — PYQs from real selection rounds
Six MCQs, then two tasks: decide where ML belongs, and turn a vague business complaint into a defined ML problem.
What is the fundamental difference between traditional programming and machine learning?
Asked in

Which problem is the WORST fit for machine learning?
Asked in

What is a 'feature' in machine learning?
Asked in

How do AI, machine learning and deep learning relate?
Asked in

A model predicts loan defaults with 99% accuracy. Only 1% of applicants actually default. What should you suspect?
Asked in

What does it mean for a model to 'generalise'?
Asked in

Hands-on tasks:
For each, say whether machine learning is the right approach and why: (1) deciding whether a user's password is correct, (2) predicting tomorrow's electricity demand for a city, (3) computing an employee's provident-fund contribution, (4) flagging fraudulent UPI transactions.
Asked in

A telecom company says: 'too many customers are leaving.' Turn that into a well-defined ML problem — target, features, type, and how you'd measure success.
Asked in

FAQ
How much data do I need to start?
It depends far more on the problem than on a number. A simple binary classification with a few strong features can work with a few thousand rows; image recognition from scratch needs orders of magnitude more. The useful practical answer: start with what you have, plot performance as you add data, and see whether the curve is still rising before investing in collecting more.
Is machine learning the same as data science?
Overlapping, not identical. Data science is the broader job — gathering and cleaning data, analysing it, visualising it, communicating findings — and ML is one tool within it. Plenty of valuable data-science work is a well-chosen chart and a clear recommendation, with no model at all.
Do I need to know the mathematics behind the algorithms?
For placement interviews, no — you need to know what each algorithm does, when to use it, and how it fails. This course teaches that. The mathematics matters when you move into research or start inventing methods, and by then you'll know why you need it.
Next lesson: the three kinds of learning, and how the data you have decides which one you can use — Lesson 2: Supervised vs Unsupervised →


