What is machine learning?
Traditional software follows rules a developer wrote. Machine learning turns that around: you supply examples, and the algorithm works out the rules itself. That matters whenever the rules are too many, too fuzzy or too fast-changing to write by hand.
Rules you write vs rules the data writes
A GST invoice checker is pure rules: if the GSTIN has 15 characters and the checksum matches, accept it. Nobody needs ML for that. But "is this UPI transaction fraudulent?" has no clean rule. Fraud patterns shift monthly, and the signal lives in dozens of weak clues: time of night, device change, amount just below a limit, merchant category. You give the model lakhs of labelled past transactions and it learns the combination.
The vocabulary is small:
| Term | Meaning | Example |
|---|---|---|
| Feature | An input column | Tenure months, average recharge, city |
| Label / target | What you want to predict | Churned yes or no |
| Model | The learned mapping from features to target | A fitted random forest |
| Training | Adjusting the model to fit examples | model.fit(X, y) |
| Inference | Using the fitted model on new rows | model.predict(X_new) |
The three families
- Supervised — learn from labelled examples. Someone already knows the answer for past rows. Regression predicts a number (next month's demand in kilograms, resale price of a used two-wheeler). Classification predicts a category (spam or not, will default or not, which of five product groups).
- Unsupervised — no labels. The model finds structure: customer segments from billing history, or compressing 40 correlated survey questions into 5 components.
- Reinforcement — an agent acts, receives a reward and learns a policy over time. Used in robotics, game playing and some pricing or logistics systems, not in everyday business analytics.
from sklearn.linear_model import LinearRegression
# 6 kirana stores: monthly footfall (hundreds) -> monthly sales (INR lakh)
X = [[12], [18], [25], [31], [40], [46]]
y = [3.1, 4.4, 6.0, 7.2, 9.1, 10.3]
model = LinearRegression().fit(X, y) # the rule is learned here
print(round(model.coef_[0], 3), round(model.intercept_, 2))
print(model.predict([[35]]).round(2)) # ~ INR 8 lakh
Nobody told the model that each extra hundred visitors adds roughly ₹0.2 lakh. It read that off the data.
When machine learning is the wrong choice
- The rule is already known and stable (tax slabs, working-hour policies). Write an
if. - You have 40 rows. Statistics and a conversation with the business beat any model.
- You cannot get the label. "Which customers are satisfied" is unanswerable unless someone recorded it.
- A wrong answer has legal or safety consequences and nobody can explain the model's reasoning.
- The data available at prediction time differs from the data you trained on — a very common project killer.
Common mistakes
- Confusing ML with automation. A model outputs a probability; a human or a rule still decides what to do with it.
- Choosing an algorithm before framing the target. Write "predict X for unit Y at time Z" first.
- Chasing deep learning for tabular business data, where gradient boosting usually wins with far less effort.
- Ignoring how the prediction will be used. A churn score no one acts on has zero value.
Practice
Write down three decisions your organisation makes repeatedly. For each, state the unit of prediction, the target column, whether it is regression or classification, where the labels would come from, and what action a prediction would trigger. Mark any that would be better solved with a simple rule.