ML Lesson 2 – Types O of Machine Learning | Dataplexa

Types of Machine Learning

Machine Learning is not a single technique. Depending on the type of data available and the problem we want to solve, Machine Learning is broadly divided into different categories.

Understanding these types is extremely important because choosing the wrong type leads to poor models, no matter how advanced the algorithm is.


Main Types of Machine Learning

There are three primary types of Machine Learning:

  • Supervised Learning
  • Unsupervised Learning
  • Reinforcement Learning

Let us understand each type carefully with examples.


1. Supervised Learning

Supervised Learning is the most commonly used type of Machine Learning.

In this approach, the model is trained using labeled data, which means every input has a known correct output.

Think of it as learning with a teacher. The model is shown the correct answers during training.

Key Characteristics

  • Input data is labeled
  • Model learns a mapping between input and output
  • Used for prediction and classification

Common Use Cases

  • Email spam detection
  • House price prediction
  • Credit risk analysis
  • Disease diagnosis

Supervised Learning Example

from sklearn.linear_model import LinearRegression

X = [[1000], [1500], [2000]]
y = [200000, 300000, 400000]

model = LinearRegression()
model.fit(X, y)

print(model.predict([[1800]]))

Here, the model learns from past house prices and predicts a new price.


2. Unsupervised Learning

In Unsupervised Learning, the data does not have labels.

The model tries to discover hidden patterns, structures, or relationships on its own.

This is similar to giving students a pile of books and asking them to organize them without instructions.

Key Characteristics

  • No labeled output data
  • Focuses on pattern discovery
  • Used for grouping and structure detection

Common Use Cases

  • Customer segmentation
  • Market basket analysis
  • Anomaly detection
  • Document clustering

Unsupervised Learning Example

from sklearn.cluster import KMeans

X = [[1,2],[1,4],[1,0],[10,2],[10,4],[10,0]]

kmeans = KMeans(n_clusters=2)
kmeans.fit(X)

print(kmeans.labels_)

The model groups data points based on similarity, without knowing the correct labels beforehand.


3. Reinforcement Learning

Reinforcement Learning is different from the previous two.

Here, an agent learns by interacting with an environment and receiving rewards or penalties.

The goal is to maximize long-term reward, not immediate accuracy.

Key Characteristics

  • No labeled dataset
  • Learning through trial and error
  • Reward-based decision making

Common Use Cases

  • Game playing (Chess, Go)
  • Robotics
  • Self-driving cars
  • Recommendation systems

A famous example is AlphaGo learning to play Go by playing millions of games.


Comparison of ML Types (Conceptual)

  • Supervised: Learns from labeled examples
  • Unsupervised: Finds structure in unlabeled data
  • Reinforcement: Learns from rewards and penalties

Mini Practice

Identify the type of Machine Learning used in each scenario:

  • Predicting student marks from past exam scores
  • Grouping customers based on shopping behavior
  • Training a robot to walk

Quick Quiz

Q1. Which ML type uses labeled data?

Supervised Learning uses labeled data.

Q2. Which ML type is best for customer segmentation?

Unsupervised Learning is best for segmentation tasks.

Q3. What guides learning in Reinforcement Learning?

Rewards and penalties guide the learning process.

In the next lesson, we will study the complete Machine Learning workflow —from raw data to a deployed model.

Types of Machine Learning

Machine Learning is not a single technique. Depending on the type of data available and the problem we want to solve, Machine Learning is broadly divided into different categories.

Understanding these types is extremely important because choosing the wrong type leads to poor models, no matter how advanced the algorithm is.


Main Types of Machine Learning

There are three primary types of Machine Learning:

  • Supervised Learning
  • Unsupervised Learning
  • Reinforcement Learning

Let us understand each type carefully with examples.


1. Supervised Learning

Supervised Learning is the most commonly used type of Machine Learning.

In this approach, the model is trained using labeled data, which means every input has a known correct output.

Think of it as learning with a teacher. The model is shown the correct answers during training.

Key Characteristics

  • Input data is labeled
  • Model learns a mapping between input and output
  • Used for prediction and classification

Common Use Cases

  • Email spam detection
  • House price prediction
  • Credit risk analysis
  • Disease diagnosis

Supervised Learning Example

from sklearn.linear_model import LinearRegression

X = [[1000], [1500], [2000]]
y = [200000, 300000, 400000]

model = LinearRegression()
model.fit(X, y)

print(model.predict([[1800]]))

Here, the model learns from past house prices and predicts a new price.


2. Unsupervised Learning

In Unsupervised Learning, the data does not have labels.

The model tries to discover hidden patterns, structures, or relationships on its own.

This is similar to giving students a pile of books and asking them to organize them without instructions.

Key Characteristics

  • No labeled output data
  • Focuses on pattern discovery
  • Used for grouping and structure detection

Common Use Cases

  • Customer segmentation
  • Market basket analysis
  • Anomaly detection
  • Document clustering

Unsupervised Learning Example

from sklearn.cluster import KMeans

X = [[1,2],[1,4],[1,0],[10,2],[10,4],[10,0]]

kmeans = KMeans(n_clusters=2)
kmeans.fit(X)

print(kmeans.labels_)

The model groups data points based on similarity, without knowing the correct labels beforehand.


3. Reinforcement Learning

Reinforcement Learning is different from the previous two.

Here, an agent learns by interacting with an environment and receiving rewards or penalties.

The goal is to maximize long-term reward, not immediate accuracy.

Key Characteristics

  • No labeled dataset
  • Learning through trial and error
  • Reward-based decision making

Common Use Cases

  • Game playing (Chess, Go)
  • Robotics
  • Self-driving cars
  • Recommendation systems

A famous example is AlphaGo learning to play Go by playing millions of games.


Comparison of ML Types (Conceptual)

  • Supervised: Learns from labeled examples
  • Unsupervised: Finds structure in unlabeled data
  • Reinforcement: Learns from rewards and penalties

Mini Practice

Identify the type of Machine Learning used in each scenario:

  • Predicting student marks from past exam scores
  • Grouping customers based on shopping behavior
  • Training a robot to walk

Quick Quiz

Q1. Which ML type uses labeled data?

Supervised Learning uses labeled data.

Q2. Which ML type is best for customer segmentation?

Unsupervised Learning is best for segmentation tasks.

Q3. What guides learning in Reinforcement Learning?

Rewards and penalties guide the learning process.

In the next lesson, we will study the complete Machine Learning workflow —from raw data to a deployed model.