What you'll learn
Quick Answer
Learn Python, then pandas, then scikit-learn, and train a model in your first week. Add mathematics as you hit the parts that need it. The single most important concept is testing on data the model has never seen — without that, an accuracy figure means nothing.
The order that actually works
The standard advice is linear algebra, then calculus, then statistics, then machine learning. It is not wrong about what you eventually need, but it puts months of abstract study before anything works, and most people quit in month two.
A better order for staying motivated, and for getting employable sooner:
- Python — functions, lists, dictionaries, file handling. A few weeks.
- pandas and NumPy — loading, filtering and grouping data. This is where most real time goes, and it is the skill that transfers to every data job.
- scikit-learn — train a model in week one of this stage. See below; it is twelve lines.
- Evaluation — train/test splits, and why accuracy alone is misleading. This is the part beginners skip and professionals care most about.
- The maths, as needed — when you want to know why a model behaves the way it does.
- Deep learning — only after the above. It is not the starting point, and for most tabular problems it is not the answer either.
Steps 1 and 2 are the bulk of the work and the least glamorous. That is not a detour — real machine learning jobs are mostly data preparation.
Your first model, in twelve lines
This is the entire supervised learning workflow. Run it and you have trained and evaluated a real model.
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42)
model = DecisionTreeClassifier(random_state=42)
model.fit(X_train, y_train)
print(accuracy_score(y_test, model.predict(X_test))) # 0.947
569 samples, split into 455 for training and 114 held back for testing. The model sees the training set, and is then judged on data it has never encountered. About 95% correct.
Every supervised problem has this shape: features X, labels y, a split, fit, predict, and a score. Changing DecisionTreeClassifier to another model is usually a one-line change, which is what makes scikit-learn a good place to learn.
The mistake that makes your accuracy meaningless
Ask the same model how it does on the data it was trained on:
print(accuracy_score(y_train, model.predict(X_train))) # 1.0
print(accuracy_score(y_test, model.predict(X_test))) # 0.947
Perfect on the training data, 94.7% on unseen data. That gap is overfitting. The tree has memorised the training set, including its noise, rather than learning the general pattern.
If you evaluate on your training data — which beginners do constantly, usually by forgetting to split at all — you will report 100% accuracy and have learned nothing about whether the model works. An accuracy figure is only meaningful on data the model has never seen.
Limiting the tree's depth reduces the memorisation:
shallow = DecisionTreeClassifier(max_depth=3, random_state=42)
shallow.fit(X_train, y_train)
# train 0.978, test 0.947
Same performance on unseen data, far less overfitting — a simpler model that generalises just as well. That is usually the better model, and knowing why is the kind of thing that separates a real answer from a memorised one in an interview.
Accuracy alone is not enough
Imagine a dataset where 99% of cases are negative. A model that predicts "negative" every single time scores 99% accuracy while being completely useless — it never detects the thing you built it to detect.
This is why you need:
- Precision — of the cases flagged positive, how many really were.
- Recall — of the real positives, how many were caught.
- Confusion matrix — the four counts underneath both numbers.
Which one matters depends on the cost of being wrong. Missing a disease is worse than a false alarm, so recall matters more. Wrongly blocking a legitimate payment is expensive, so precision matters more. Being able to reason about that trade-off for your specific problem is more valuable than knowing another algorithm.
How much mathematics you actually need
To use the standard tools competently: enough statistics to understand mean, variance, distributions and correlation, plus a working intuition for what a gradient is. That is genuinely most of it for applied work.
To go deeper — designing models rather than applying them, or research — you need linear algebra and calculus properly. That is a real requirement, but it is a second-year requirement, not a prerequisite for starting.
Learn the maths at the point where a model's behaviour puzzles you. Studying gradient descent after watching a model fail to converge is a completely different experience from studying it cold, and it sticks.
Build something with data you care about
The most common trap is finishing five tutorials on the same three datasets. Everyone has trained a classifier on iris; nobody has trained one on a question they were personally curious about, and only the second one is interesting to talk about.
Pick a real question with a real dataset, and be honest about the result — including if the model does not work well. "I tried to predict X, got 61% accuracy, and here is why I think the features were insufficient" is a much stronger interview answer than a notebook reproducing a tutorial at 99%.
Our retail sales forecasting and data analysis builds are set up around exactly that structure, and explaining your project in an interview covers how to talk about it afterwards.
