Module 2: Machine Learning Fundamentals
7. Exercise: Classifying Machine Learning Problems
Description
This is Module 2's practice lesson: here you'll apply everything you learned about Machine Learning by classifying real-world problems according to the type of ML they need (supervised, unsupervised, reinforcement) and the subtype where applicable (classification, regression, clustering, etc.). The goal isn't to memorize definitions; the goal is for you to be able to reason about what type of ML you'd use to solve a concrete problem and justify your answer.
This exercise is critical because when you work as an AI Engineer, product or business people will ask you "how can we use AI for this?" or "what type of model do we need?". Knowing how to classify problems lets you answer precisely, propose solutions, and communicate with technical teams.
Instructions
For each problem:
- Classify what type of ML you'd use: Supervised, Unsupervised or Reinforcement.
- Specify the subtype where applicable:
- If supervised: classification or regression?
- If unsupervised: clustering, dimensionality reduction or something else?
- If reinforcement: identify the agent, environment, actions, reward.
- Justify in 1-2 sentences why you chose that type and what data you'd need.
Recommended answer format:
Problem X:
- Type of ML: [Supervised / Unsupervised / Reinforcement]
- Subtype: [Classification / Regression / Clustering / etc.]
- Justification: [Why that type and what data you need]
Problems to classify
Problem 1: Predict whether a customer will buy a product
Context: You have data on 50,000 customers (age, purchase history, site browsing, location). For each customer, you know whether they bought product X or not.
Task: Predict whether a new customer will buy product X.
See solution
Type of ML: Supervised Learning
Subtype: Binary classification (buys / doesn't buy)
Justification: You have labeled data (customers with the label "bought" or "didn't buy"). The model learns patterns that distinguish buyers from non-buyers. When a new customer arrives (without a label), the model predicts whether they'll buy or not.
Data needed: Customer history with features (age, previous purchases, browsing, location) and a label (bought yes/no).
Problem 2: Group customers into segments for marketing
Context: You have data on 100,000 customers (age, purchases, visit frequency, location). You don't know in advance what segments exist or how many there are.
Task: Group customers into segments by similarity in order to design different marketing campaigns per segment.
See solution
Type of ML: Unsupervised Learning
Subtype: Clustering
Justification: You don't have labels (you don't know in advance what segments exist or which customers belong to which segment). The model groups customers by similarity (e.g. K-means). Then you interpret the clusters (e.g. "young customers who buy a lot", "older customers who buy little") and design campaigns per cluster.
Data needed: Customer features (age, purchases, frequency, location) without segment labels.
Problem 3: Estimate the sale price of a house
Context: You have data on 10,000 sold houses (size, location, number of rooms, year built, sale price).
Task: Predict how much a new house is worth based on its features.
See solution
Type of ML: Supervised Learning
Subtype: Regression
Justification: You have labeled data (houses with features and a known price). The model learns which features influence the price (e.g. more square meters → higher price). When a new house arrives (without a known price), the model predicts how much it should be worth.
Data needed: House features (size, location, rooms, year) and sale price (a numeric label).
Problem 4: Detect fraudulent transactions at a bank
Context: You have data on millions of transactions (amount, location, time, type of merchant). Most are normal; very few are fraud. You have labels for some transactions (fraud / not fraud), but not for all.
Task: Detect suspicious transactions that could be fraud.
See solution
Type of ML: It can be Supervised or Unsupervised (depending on the approach)
Approach 1: Supervised (if you have enough labels)
Subtype: Binary classification (fraud / not fraud)
Justification: If you have many transactions labeled as fraud/not-fraud, the model learns fraud patterns and predicts whether a new transaction is fraud.
Approach 2: Unsupervised (if you don't have labels or want to detect unseen anomalies)
Subtype: Anomaly detection (clustering + outliers)
Justification: The model groups normal transactions into clusters; the ones that fall far from the main clusters (outliers) are flagged as suspicious (possible fraud). You don't need labels; the model detects what's "odd".
Most common: A combination of both: supervised for known frauds + unsupervised for new anomalies.
Data needed: Transaction features (amount, location, time, merchant). If supervised: labels (fraud/not-fraud) for training. If unsupervised: only the features.
Problem 5: Train a robot to walk in a physical space
Context: You have a humanoid robot in a simulation (or in the real world). It can move its joints (knee, ankle, hip angles). There's no labeled data for "the correct way to walk".
Task: Have the robot learn to walk without falling.
See solution
Type of ML: Reinforcement Learning
Components:
- Agent: The robot
- Environment: Physical space (or a simulation)
- Actions: Moving joints (knee, ankle, hip angles)
- State: The position and velocity of each joint, the position of the center of mass, whether it's on the ground or not
- Reward: +1 for each step forward without falling, -10 if it falls, 0 if it doesn't advance
Justification: There's no labeled data for "the correct way to walk". The robot learns by trial and error: it tries movements, receives feedback (a high reward if it advances without falling, a low reward if it falls), and adjusts its policy to maximize reward.
Data needed: No labeled data; only the simulation (or real environment) where the robot can try actions and receive feedback.
Problem 6: Recommend movies to Netflix users
Context: You have data on millions of users (what you watched, what you rated, how long you watched). You want to recommend movies you'll like.
Task: Predict which movies you'll like and recommend them.
See solution
Type of ML: It can be Supervised, Unsupervised or Reinforcement (Netflix uses a combination)
Approach 1: Supervised (rating prediction)
Subtype: Regression (predicting the rating you'd give a movie) or Classification (predicting whether you'll like it or not)
Justification: If you have user ratings for movies (e.g. user X rated movie Y with 4 stars), the model learns to predict what rating you'd give to movies you haven't seen. It recommends the ones with a high predicted rating.
Approach 2: Unsupervised (collaborative filtering, clustering)
Subtype: Clustering of users or movies
Justification: The model groups users with similar tastes or similar movies. It recommends movies that users in your cluster liked, or movies similar to the ones you already watched.
Approach 3: Reinforcement (optimizing long-term engagement)
Subtype: An agent that learns which recommendations maximize engagement (time in the app, movies watched all the way through)
Justification: The agent tries recommendations, receives feedback (if you watched the movie all the way through → a high reward; if you ignored it → a low reward), and adjusts to maximize engagement.
Most common: A combination of supervised (rating prediction) + unsupervised (collaborative filtering) + reinforcement (optimizing long-term engagement).
Data needed: User history (what you watched, what you rated, how long you watched). If supervised: ratings as labels. If unsupervised: only the history. If reinforcement: interaction feedback (whether you watched it all the way through, whether you clicked, etc.).
Problem 7: Classify emails as spam or not-spam
Context: You have 100,000 emails manually labeled as spam or not-spam (email body, subject, sender).
Task: Classify new emails as spam or not-spam.
See solution
Type of ML: Supervised Learning
Subtype: Binary classification (spam / not-spam)
Justification: You have labeled data (emails marked as spam or not-spam). The model learns patterns that distinguish spam (e.g. words like "free", "make money", lots of exclamation marks) from not-spam. When a new email arrives, the model predicts whether it's spam.
Data needed: Emails with content (text, subject, sender) and a label (spam / not-spam).
Problem 8: Compress images while keeping visual quality
Context: You have high-resolution images (e.g. 4K) and you want to reduce their size (e.g. to 1080p or less) without losing much visual quality.
Task: Reduce the size of the images while keeping essential visual information.
See solution
Type of ML: Unsupervised Learning (or related compression techniques)
Subtype: Dimensionality reduction (or autoencoders, a type of neural network)
Justification: There are no labels (there's no "correct answer" for which information to keep; it depends on what you consider "essential"). Techniques like autoencoders learn to compress the image (reduce dimensions) and then reconstruct it while keeping important visual information. The goal is to minimize the difference between the original and reconstructed image.
Data needed: High-resolution images (without labels). The model learns to compress and reconstruct without explicit supervision.
Note: Traditional compression formats (JPEG, PNG) use techniques that aren't necessarily ML; but modern techniques (e.g. autoencoders, VAEs) use unsupervised learning.
Problem 9: Train an agent to play chess
Context: You want an agent to learn to play chess without giving it explicit strategy rules (only the rules of the game: how the pieces move, what checkmate is).
Task: Have the agent learn to play well (win games).
See solution
Type of ML: Reinforcement Learning
Components:
- Agent: The system that plays chess
- Environment: The chessboard (state = the position of the pieces)
- Actions: Moving a piece (e.g. "move bishop from c4 to f7")
- State: The current position of all the pieces on the board
- Reward: +1 if it wins the game, -1 if it loses, 0 during play (or intermediate rewards if it captures valuable pieces)
Justification: There's no labeled data of "correct moves" for each position (that would be supervised). The agent learns by trial and error: it plays thousands of games (against itself or others), receives feedback (a reward if it wins), and adjusts its policy to maximize victories.
Data needed: No labeled data; only the environment (the chessboard, the rules of the game) where the agent can play and receive feedback.
Note: Modern systems like AlphaZero use RL (self-play: playing millions of games against itself) + search (Monte Carlo Tree Search).
Problem 10: Reduce a dataset from 100 variables to 3 for visualization
Context: You have a dataset with 100 variables (columns) and 10,000 rows (examples). You want to visualize the data in 2D or 3D to see patterns, but you can't plot 100 dimensions.
Task: Reduce the 100 variables to 2-3 variables (dimensions) while keeping the most important information, in order to plot them and see patterns.
See solution
Type of ML: Unsupervised Learning
Subtype: Dimensionality Reduction (e.g. PCA, t-SNE, UMAP)
Justification: There are no labels (there's no "correct answer" for which variables are "most important"; it depends on which patterns you want to see). Algorithms like PCA (Principal Component Analysis) reduce dimensions while keeping the most important variance; t-SNE and UMAP reduce to 2-3 dimensions, optimizing so that similar points end up close together in the plot.
Data needed: A dataset with 100 variables (without labels). The algorithm reduces it to 2-3 variables you can plot.
Common use: Data exploration before training a supervised model; visualizing embeddings (e.g. text or image representations).
Problem 11: Predict how many units of a product will sell next month
Context: You have historical sales data (units sold each month) for the last 5 years, with variables like price, promotions, season, location.
Task: Predict how many units will sell next month.
See solution
Type of ML: Supervised Learning
Subtype: Regression (time series forecasting)
Justification: You have labeled data (past months with known units sold). The model learns temporal patterns (e.g. high sales in December, low in January) and relationships (e.g. promotions → more sales). When next month comes, the model predicts how many units will sell.
Data needed: Sales history (units per month) with explanatory variables (price, promotions, season, location). The label is the number of units sold in each month.
Note: Time series require specific techniques (e.g. ARIMA, LSTM, Prophet) but they're still supervised learning (learning from data with known answers).
Problem 12: Organize Google Photos photos by content (without labels)
Context: You have millions of user photos without labels (without knowing what's in each photo). You want to organize them by visual content (e.g. landscapes, people, objects, animals) so users can search.
Task: Group photos by visual content without labeling each photo manually.
See solution
Type of ML: It can be Supervised (if you use a pre-trained model) or Unsupervised (if you group without labels)
Approach 1: Supervised with a pre-trained model (more common in production)
Subtype: Multiclass classification (cat, dog, person, landscape, etc.)
Justification: You use a pre-trained model (e.g. ImageNet: 1,000 categories) that already learned to recognize objects. The model classifies each photo (e.g. "cat", "landscape"). That gives you automatic labels without labeling manually.
Approach 2: Unsupervised (visual clustering)
Subtype: Clustering of image embeddings
Justification: You convert each photo into a vector (an embedding) using a neural network; then you group photos with similar embeddings (clustering). The clusters represent visually similar photos. You interpret what each cluster represents (e.g. "beach photos", "pet photos").
Most common: Approach 1 (using a pre-trained model) because it already has useful categories. But if you want to discover your own groupings (not predefined categories), you use approach 2.
Data needed: Photos without labels. If approach 1: a pre-trained model (trained with ImageNet or another labeled dataset). If approach 2: only the photos; the model finds the groupings.
Additional problems (bonus)
If you want to practice more, here are 3 additional problems:
Problem 13: Predict whether an email will be marked as important (Gmail)
Context: You have data on millions of emails and whether the user marked them as "important" or not.
Task: Predict whether a new email will be important to the user.
See solution
Type of ML: Supervised Learning
Subtype: Binary classification (important / not important)
Justification: You have labeled data (emails marked by the user as important or not). The model learns patterns (e.g. emails from certain senders, with certain words, etc. tend to be important). When a new email arrives, the model predicts whether it will be important.
Data needed: Emails with content (text, sender, subject) and a label (important / not important).
Problem 14: Train an agent to optimize delivery routes
Context: You have an agent (a system) that must decide in what order to deliver packages in a city in order to minimize time or distance. There's no predefined "correct route"; it depends on traffic, delivery priority, etc.
Task: Have the agent learn to choose routes that minimize time/distance.
See solution
Type of ML: Reinforcement Learning (or optimization algorithms combined with RL)
Components:
- Agent: The system that chooses routes
- Environment: A map of the city with traffic, distances, priorities
- Actions: Choosing the next delivery (which address to go to)
- State: Current location, pending packages, traffic
- Reward: -1 for each minute of time (goal: minimize time); +10 if it meets the delivery priority
Justification: There's no predefined "correct route" (that would be supervised); it depends on dynamic conditions (traffic, urgency). The agent learns by trial and error: it tries routes, receives feedback (a low reward if it takes too long), and adjusts to minimize time.
Data needed: A simulation or real environment where the agent can try routes and receive feedback (time, distance).
Note: In practice, classic optimization algorithms (Traveling Salesman Problem, TSP) are combined with RL to adapt to dynamic conditions.
Problem 15: Detect whether a product review is fake
Context: You have millions of product reviews. Some are genuine; others are fake (written by bots or paid for). You have labels for some reviews (genuine / fake) but not for all.
Task: Detect suspicious reviews that could be fake.
See solution
Type of ML: Supervised Learning (if you have enough labels)
Subtype: Binary classification (genuine / fake)
Justification: If you have reviews labeled as genuine or fake, the model learns patterns (e.g. fake reviews use generic language, have lots of superlatives, the user's profile is recent, etc.). When a new review arrives, the model predicts whether it's genuine or fake.
Data needed: Reviews with content (text, rating, user profile) and a label (genuine / fake).
Alternative approach (unsupervised): If you don't have enough labels, you can use anomaly detection (clustering + outliers): group normal reviews and flag the ones far from the main clusters as suspicious.
Final reflection
After classifying these problems, reflect:
-
What patterns did you see? E.g. if you have labeled data with correct answers → supervised; if you're looking for patterns without labels → unsupervised; if you learn by trial and error with feedback → reinforcement.
-
Which type of ML is most common? In commercial products, supervised learning is the most common (spam filters, image classification, price prediction, recommendations). Unsupervised is useful for exploration and anomaly detection. Reinforcement is less common in commercial applications but key in games, robotics and dynamic optimization.
-
How would you apply this in your work? If product or business asks you "can we use AI for X?", you can now classify the problem, propose the type of ML, and explain what data you need.
Common mistakes when classifying problems
1. Confusing "having data" with "having labels"
Mistake: Thinking that any problem with data is supervised.
Reality: Supervised requires labeled data (correct answers). If you have data but without labels (e.g. photos without knowing what's in them), it's unsupervised.
2. Thinking reinforcement is for "any optimization"
Mistake: Classifying any optimization problem as reinforcement.
Reality: Reinforcement is when an agent learns by trial and error in a dynamic environment receiving feedback (rewards). If you can formulate the problem with labeled data, it's supervised. If you can use classic optimization algorithms (e.g. linear programming), you don't need RL.
3. Not identifying the subtype (classification vs regression)
Mistake: Saying "supervised" without specifying whether it's classification or regression.
Reality: Always clarify: are you predicting a category (classification) or a number (regression)? That affects which algorithm you use and how you evaluate the model.
4. Assuming a problem has only one solution
Mistake: Thinking every problem has a single correct type of ML.
Reality: Many problems allow several approaches (e.g. recommendations: supervised + unsupervised + reinforcement). The choice depends on available data, resources, and business goals.
Evidence of success
You know you've made good use of this exercise when:
- You've classified at least 10 problems (of the 12 main ones) with a type and subtype of ML.
- You can justify in 1-2 sentences why you chose that type (not just "because it has labels", but reasoning about the data, goal, and flow).
- You can identify what data you'd need for each problem.
- You can apply this reasoning to new problems (e.g. if product asks you "can we predict X?", you know how to classify the problem and propose a solution).
If any problem was difficult for you, go back to lessons 03 (Supervised), 04 (Unsupervised), 05 (Reinforcement) to review the concepts.
Summary
Goal of the exercise: Applying the module's concepts (supervised, unsupervised, reinforcement, classification, regression, clustering, etc.) by classifying real-world problems.
What you practiced:
- Identifying whether the problem has labels (supervised), has no labels (unsupervised) or learns from feedback (reinforcement).
- Specifying the subtype (classification, regression, clustering, dimensionality reduction, etc.).
- Reasoning about what data you need and how the model would work.
Next step: With this exercise you finish Module 2 (Machine Learning Fundamentals). In Module 3 (Neural Networks) you'll see how neural networks work: a type of supervised or unsupervised learning model that is the foundation of Deep Learning, Transformers and LLMs.
Additional resources
-
Kaggle: Practice Classification Problems — A platform with ML competitions for practicing classification, regression, etc. In English.
-
Google ML Crash Course: Exercises — Interactive exercises on supervised learning. In English.
-
Fast.ai: Practical Deep Learning - Lesson 1 Exercises — Image classification exercises. In English. More technical (with code).
-
Elements of AI – Exercises — Exercises classifying AI/ML problems. Available in several languages.
-
Scikit-learn: Choosing the right estimator — A flowchart for choosing an algorithm by type of problem. In English. Useful for implementation.
-
Andrew Ng: ML Specialization - Quizzes — Quizzes on classifying problems. In English.