Framing ML Problems
ML Engineer path · lesson 62 of 80"Slow customer support is a problem, but it is not an ML problem." Turn a complaint into inputs, outputs and an objective function, then reframe an app recommender so adding a new app stops forcing a retrain.
Key insight
Inputs, outputs, objective function. If you cannot write all three down, you do not have an ML problem yet — you have a business complaint, and the work in front of you is product work rather than modelling work.
Frame the task
Sort each problem into the ML task type it is.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Regression
Drop items hereBinary classification
Drop items hereMulticlass
Drop items hereMultilabel
Drop items hereTest your knowledge
An ML problem is defined by inputs, outputs, and:
The short version
Two ways to ask a shop assistant what you should buy. You can ask "which of these 40,000 items is for me?" — and every time the shop gets new stock, the assistant has to relearn the catalogue. Or you can hold up one item and ask "is this for me?", forty thousand times. Same information, and only one of them survives a delivery.
In more depth
Framing ML Problems
"Slow customer support is a problem, but it's not an ML problem."
An ML problem is defined by inputs, outputs, and an objective function. The bank example: the bottleneck is routing requests among four departments (accounting, inventory, HR, IT) ⇒ a classification problem. Input = the customer request. Output = the department. Objective = minimise the difference between predicted and actual.
Types of ML tasks
Multiclass vs multilabel
Four topics [tech, entertainment, finance, politics]. Multiclass "entertainment" = [0, 1, 0, 0]; multilabel "entertainment and finance" = [0, 1, 1, 0].
Multilabel is the task type companies have the most problems with, for two reasons:
Two framings of the same problem
Predicting the next app a user opens:
| Naive multiclass | Regression framing | |
|---|---|---|
| Input | user + environment features | + the app's features |
| Output | distribution over all N apps | one value 0–1 |
| Predictions per slot | 1, of size N | N, each a number |
| A new app costs | a retrain | nothing |
Objective functions
Also called loss functions: RMSE or MAE for regression, log loss for binary classification, cross entropy for multiclass. Worked: ground truth [0,0,0,1], prediction [0.45, 0.2, 0.02, 0.33], loss = −Σ p·log(q).
Decoupling objectives
Newsfeed ranking: extreme posts get more engagement, so engagement-maximisation prioritises extreme content. Five objectives, and quality conflicts with engagement.
α·quality_loss + β·engagement_loss. Systematic tuning is Pareto optimization. Every retune requires retraining.α·quality_score + β·engagement_score. Tweak α and β without retraining.Second reason to decouple: different objectives need different maintenance schedules. "Spamming techniques evolve much faster than the way post quality is perceived."
Interview Questions
References & Further Reading
Related topics
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required