Machine Learning
Spring 2025 - Week 11 (Contd.)
Gaussian Naïve Bayes Classifier
Dr. M. Daud Abdullah Asif
Assistant Professor
Faculty of Computing, SEECS
Email: daud.abdullah@seecs.edu.pk
Lecture Outline
• Recap of previous lecture
• Naïve Bayes Classifier
• Gaussian Naïve Bayes Classifier
Recap of Probability Distributions
3
Recap - Bayes Theorem
𝑃 𝐵 𝐴 .𝑃(𝐴)
•𝑃 𝐴 𝐵 =
𝑃(𝐵)
• where
• 𝑃 𝐴 𝐵 Posterior: Probability of hypothesis 𝐴 given the observed data 𝐵
• 𝑃 𝐵 𝐴 likelihood: Probability of the data given the hypothesis
• 𝑃(𝐴) Prior: Initial belief about 𝐴 before seeing the data
• 𝑃(𝐵) Evidence: Normalizing constant, the total probability of the data
4
Recap - Naïve Bayes Classifier
• A supervised learning algorithm based on Bayes’
Theorem with a strong (naïve) assumption of feature
independence
• Applications:
• Disease Diagnosis
• Document Classification
• Credit Scoring
• Sentiment Analysis
• Recommender Systems
• Spam Filtering
5
Recap - Laplace Smoothing
• Used when zero frequency problem occurs
• Add a Laplace Smoothing Factor Alpha to each event
• Default value of Alpha is 1
• Note: Add a small constant α (often 1) to all frequency counts to
ensure no probability becomes zero
6
Gaussian Naïve Bayes Classifier
• Used when features are continuous (not categorical)
• Assumes independence among features and normal distribution
• Referred as Gaussian Distribution
• The likelihood is modeled using the Gaussian Probability Density
Function
1 1 𝑥−𝜇 2
− ( )
𝑓 𝑥 = 𝑒 2 𝜎
𝜎 2𝜋
7
In-class Activity
• Make a group of 4 students
• Find a use case of Gaussian Naïve Bayes Classifier
• 5 mins
8
Gaussian Naïve Bayes Classifier
• Example – Gender Classification
• Classify a new person whose height is 6ft, weight is 130 lbs,
and foot size is 8 inch.
9
Gaussian Naïve Bayes Classifier – Example
10
Gaussian Naïve Bayes Classifier – Example
1 𝑥−𝜇 2
1 − ( )
•𝑓 𝑥 = 𝑒 2 𝜎
𝜎 2𝜋
11
Gaussian Naïve Bayes Classifier – Example
1 𝑥−𝜇 2
1 − ( )
•𝑓 𝑥 = 𝑒 2 𝜎
𝜎 2𝜋
• Based on your calculations, what is the gender of the new test
sample?
• Male / Female?
12
Questions?