MACHINE LEARNING • LESSON 2

Choosing the Right Type of ML

Different machine learning problems need different approaches. The easiest way to choose the right type of ML is to first understand what kind of answer you want from the model.

THE CORE IDEA

Start with the problem, not the algorithm.

Before choosing a machine learning algorithm, ask: Do I have known answers? What kind of answer do I want? Or am I trying to discover hidden groups?

01

Step 1: Do You Have Known Answers?

First, ask whether your training data already contains the correct answers.

If the correct answers are available, you are usually working with supervised learning.

If the correct answers are not available and you want the model to discover patterns, you may be working with unsupervised learning.

QUESTION Do I have known answers?
YES Supervised Learning

Learn from examples with known answers.

/
NO Unsupervised Learning

Discover patterns or groups.

02

If You Have Known Answers: What Are You Predicting?

If you have labelled training data, look at the type of answer you want to predict.

Is it a category or a number?

CATEGORY Classification

Example: Spam or Not Spam

NUMBER Regression

Example: House Price = $350,000

Easy rule:

Category → Classification

Number → Regression

03

Example: Predicting Spam Emails

Imagine you have thousands of emails.

Each email has already been labelled as either Spam or Not Spam.

TRAINING DATA Emails + Labels
TARGET Category
CHOICE Classification

The model needs to predict one of the known categories: Spam or Not Spam.

Therefore, this is a classification problem.

04

Example: Predicting House Prices

Now imagine you have information about thousands of houses and their actual selling prices.

You want to predict the price of a new house.

TRAINING DATA Houses + Actual Prices
TARGET Numerical Value
CHOICE Regression

The model is predicting a numerical value such as $350,000.

Therefore, this is a regression problem.

05

Example: Discovering Customer Groups

Now imagine an online store has thousands of customers.

The store has customer information, but nobody has labelled the customers into groups.

The company wants to discover groups of customers who behave similarly.

DATA Customer Behavior
LABELS No Predefined Groups
CHOICE Clustering

The goal is not to predict an existing category. The goal is to discover groups in the data.

Therefore, this is a clustering problem.

06

What About Reinforcement Learning?

Reinforcement learning is different from the problems we have discussed so far.

Instead of simply predicting a label, number, or group, an agent interacts with an environment and learns from the results of its actions.

AGENT Takes an Action
ENVIRONMENT Responds
REWARD Learns From the Result

A simple example is a game-playing agent.

It takes actions, sees what happens, receives rewards or penalties, and gradually learns which actions lead to better results.

07

The Simple Decision Tree

You can use this simple process when starting a machine learning problem.

START What are you trying to do?
KNOWN LABELS Yes

You have examples with known answers.

Predict a category? → Classification
Predict a number? → Regression
KNOWN LABELS No

You want to discover patterns or groups.

Discover groups? → Clustering
ACTIONS + REWARDS Agent learns by interacting with an environment → Reinforcement Learning
08

One Problem Can Make the Choice Clear

Imagine an e-commerce company wants to use machine learning.

Look at these four different problems:

Problem Goal ML Type
Detect fraudulent orders Predict Fraud / Not Fraud Classification
Predict product sales Predict a number Regression
Find customer groups Discover similar customers Clustering
Train an agent to play a game Learn actions from rewards Reinforcement Learning
09

Do Not Choose an Algorithm Too Early

A common beginner mistake is to immediately ask: "Should I use Decision Tree, KNN, or another algorithm?"

That is the wrong first question.

First understand the machine learning problem.

STEP 1 Understand the Problem
STEP 2 Identify the ML Type
STEP 3 Choose an Algorithm

For example, if you discover that your problem is classification, you can then compare suitable classification algorithms.

10

The Whole Lesson in One Picture

SUPERVISED Known Answers Classification or Regression
UNSUPERVISED No Known Answers Discover Groups → Clustering
CLASSIFICATION Predict a Category
REGRESSION Predict a Number
CLUSTERING Discover Groups
REINFORCEMENT LEARNING Learn Through Actions and Rewards
KEY IDEA

Choose the ML Type Based on the Problem You Are Solving.

Known category → Classification. Known numerical value → Regression. No predefined groups → Clustering. Learning through actions and rewards → Reinforcement Learning.

QUICK CHECK

Choose the Right Type

A company has customer data and wants to predict whether a customer will leave the service.

Answer

If the answer is Leave or Stay, this is classification.

Another company wants to predict the amount a customer will spend next month.

Answer

This is regression, because the answer is a numerical value.

Finally, a company has customer behavior data but no customer groups and wants to discover groups of similar customers.

Answer

This is clustering, because the groups need to be discovered from the data.

LESSON 2 COMPLETE

Types of Machine Learning

You now know the major types of machine learning and how to identify which type fits a problem. Next, we will learn how a machine learning system works from beginning to end.