Intro to Machine Learning for Analysts
Part of the Data Analyst Roadmap
In short
Machine learning sounds like magic, but for analysts it mostly means letting a model learn patterns from examples instead of writing every rule yourself. Knowing the basics helps you use it wisely.
A conceptual overview of what ML models are (pattern-matching functions trained on data) and where analysts fit in — usually preparing data and validating outputs, not building models from scratch.

Think of it like this
Teaching a robot about mangoes
You could write rules: yellow, soft, sweet smell means ripe. Or show a little robot a hundred mangoes labelled ripe or not and let it work out the pattern. That second way is machine learning. It works well with lots of good examples and falls over with bad ones.
Watch it happen
Rules you write vs patterns it learns
Hand-written rules
- Easy to explain and audit
- Break when patterns get complex
- Need updating by hand
Machine learning
- Learns patterns from labelled examples
- Handles many inputs at once
- Needs good data and testing
Start with simple rules or a simple model. Reach for ML when rules get messy and you have plenty of labelled examples.
The big ideas
What you need to know
Supervised learning
Examples come with answers, like churned or not. The model learns to predict the answer. Regression and classification live here.
Unsupervised learning
No answers given. The model finds structure, like clusters of similar customers.
Train, test, repeat
Fit on one part of the data, judge on another. Overfitting means great on training, poor on new data.
Explainability matters
Business users trust what they understand. A simple model you can explain often beats a black box.
See it in code
Walk through the code
1from sklearn.model_selection import train_test_split2from sklearn.tree import DecisionTreeClassifier3 4X = df[["weight_g", "softness", "colour_score"]]5y = df["ripe"]6X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)7 8for depth in [2, 5, None]:9 tree = DecisionTreeClassifier(max_depth=depth, random_state=0).fit(X_train, y_train)10 print(depth, "train:", round(tree.score(X_train, y_train), 2),11 "test:", round(tree.score(X_test, y_test), 2))1/3Inputs, labels, and a 70/30 train/test split.
The same model at three depths. Watch training accuracy rise while test accuracy stalls or drops: that's overfitting.
Save yourself the pain
Common mistakes
Oops
Judging a model by its accuracy on the training data.
Do this instead
Always report performance on a held-out test set, ideally from a later time period.
Oops
Using ML because it sounds impressive.
Do this instead
Try a simple baseline first, like last month's value or a rule. ML must beat it to earn its place.
Your mission
See overfitting yourself
Quick check
A model scores 99% on training data and 70% on test data. What's most likely happening?
Go deeper
- 1Read a high-level explainer distinguishing supervised, unsupervised, and reinforcement learning.
- 2Identify what a data scientist would need from you to build a model well.
- 3Learn to critically evaluate a model's output, not just accept it as ground truth.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.