Frame a real problem as supervised regression, supervised classification or an unsupervised task, with the right features and baseline.
Why this matters
"Machine learning" gets attached to everything from spam filters to self-driving cars, so it helps to have a precise definition. A machine learning (ML) system is a program whose behaviour is learned from examples instead of written as rules by hand. You do not write if subject contains "free money" then spam. You collect thousands of emails already marked spam or not spam, and an algorithm finds the patterns that separate them.
Before you write any code, the most valuable skill is framing: turning a vague business or science question into a learning problem with clear inputs, a clear output, and a way to tell whether the model is any good. A well-framed problem with a simple model beats a badly framed one with a fancy model every time.
The vocabulary
Every tabular ML problem has the same parts:
- Rows (examples, samples, observations): one customer, one email, one lab sample.
- Features (inputs,
X): the columns the model may look at, such as age, number of visits, or word counts. - Label (target,
y): the answer you want to predict, such as "churned or not" or "house price". - Model: a function with adjustable parameters that maps features to a prediction.
- Training: choosing parameter values that make predictions match the labels on known examples.
- Inference: using the trained model on new rows where the label is unknown.
features X label y
visits spend tenure_months -> churned
3 120 14 0
0 15 2 1
11 480 30 0
Supervised learning
In supervised learning every training row has a label, and the model learns to predict it. There are two main flavours:
- Regression: the label is a number. Predict a house price, tomorrow's energy demand, or a patient's length of stay.
- Classification: the label is a category. Spam or not, which of 10 digits, fraud or legitimate. Most classifiers output a probability for each class, and you pick a threshold to turn it into a decision.
Module 2 covers the core supervised models: linear and logistic regression, decision trees and random forests.
Unsupervised learning
In unsupervised learning there are no labels. The goal is to find structure in the features themselves:
- Clustering: group similar rows, for example customer segments (k-means, Module 3).
- Dimensionality reduction: compress many correlated columns into a few, for plotting or as model input (PCA).
- Anomaly detection: flag rows that look unlike the rest, such as a strange transaction or a faulty sensor reading (isolation forest).
Unsupervised results are harder to evaluate because there is no right answer to compare against. You judge them by whether they are stable and useful to a human.
You will also hear of reinforcement learning, where an agent learns by trial and reward (games, robotics). It is outside this course.
Framing worked examples
| Question | Label? | Problem type |
|---|---|---|
| Will this customer cancel in the next 30 days? | yes/no from history | supervised classification |
| How many kWh will this building use tomorrow? | past usage | supervised regression |
| What natural groups exist among our 50,000 customers? | none | clustering |
| Which of today's 1 million card payments look unusual? | rarely any | anomaly detection |
| Which of these 300 gene-expression columns carry most of the variation? | none | dimensionality reduction |
Notice that the same data can support different framings. Payment data with confirmed fraud labels supports supervised classification; without labels, you fall back to anomaly detection.
When you frame a problem, write down four things:
- The prediction and when it is made ("at the start of each month, predict churn in the next 30 days").
- The features available at that moment, and only those. Anything recorded later is off limits.
- The success metric (accuracy, recall, mean absolute error) and the baseline to beat, such as "always predict the most common class".
- The cost of mistakes. Missing a fraud case and blocking a good customer usually cost different amounts.
The standard workflow
frame the problem -> collect and clean data -> split train/validation/test
-> engineer features -> train a model -> evaluate on validation
-> tune -> final check on test -> deploy and monitor
This course walks through that loop. You will implement each algorithm from scratch with NumPy so you see what happens inside, and each lesson shows the matching scikit-learn call (LinearRegression, KMeans, train_test_split...), which is what you will use at work.
When not to use ML
ML is the wrong tool when a simple rule works, when you have very little data, when you cannot get labels and cannot judge unsupervised results, or when a mistake is unacceptable and the model cannot be explained. "Flag every invoice over $10,000 for review" does not need a model.
Common mistakes
- Using features from the future. A "cancellation reason" column only exists after the customer leaves; including it makes the model look perfect and useless.
- No baseline. 95% accuracy sounds great until you notice 95% of customers never churn.
- Confusing correlation with cause. A model that predicts well does not tell you what would happen if you changed a feature.
- Skipping the framing. Starting with "let's try a neural network" before agreeing what is being predicted, when, and why.
Careers note
Data scientists and machine learning engineers use these ideas daily. Employers usually look for a bachelor's degree in a quantitative field or computer science (a master's is common for data science roles), plus a portfolio of real projects. Machine learning engineers also need solid production software skills. This course gives you the foundations; projects and practice on real data are what turn them into a job.
Quick recap
- ML learns behaviour from examples instead of hand-written rules.
- Supervised learning predicts a known label (regression for numbers, classification for categories).
- Unsupervised learning finds structure without labels (clustering, dimensionality reduction, anomaly detection).
- Frame first: the prediction, the features available at prediction time, the metric and baseline, and the cost of mistakes.
Try it
Take the quiz on the Do tab to check you can frame problems correctly.