0% found this document useful (0 votes)
26 views5 pages

Naive Bayes Practice Set

The document contains a series of problems related to Naive Bayes classification techniques, including Bernoulli, Multinomial, and Gaussian methods. Each problem presents a specific scenario, such as disease diagnosis, email classification, and customer churn prediction, requiring the calculation of posterior probabilities based on given data. The problems also address various challenges, including missing values, feature dependency violations, and class imbalance.

Uploaded by

masterpubg323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

Naive Bayes Practice Set

The document contains a series of problems related to Naive Bayes classification techniques, including Bernoulli, Multinomial, and Gaussian methods. Each problem presents a specific scenario, such as disease diagnosis, email classification, and customer churn prediction, requiring the calculation of posterior probabilities based on given data. The problems also address various challenges, including missing values, feature dependency violations, and class imbalance.

Uploaded by

masterpubg323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Naive Bayes Numerical Problems

Instructions
For each problem below, compute the required posterior probabilities using appropriate Naive
Bayes assumptions (Bernoulli, Multinomial, or Gaussian as indicated). Assume features are
conditionally independent given the class.

Problem 1: Disease Diagnosis (Categorical)


Task: Compute the probability of a person having fever given they have both COVID and
Flu. Use Bernoulli Naive Bayes.

Person COVID Flu Fever


1 Yes No Yes
2 No Yes Yes
3 Yes Yes Yes
4 No No No
5 Yes No Yes
6 No No Yes
7 Yes No Yes
8 Yes No No
9 No Yes Yes
10 No Yes No

Problem 2: Email Classification (Multinomial)


Task: Classify a new email with word counts: offer=2, free=1, win=3. Use Laplace
smoothing (α = 1).

1
Email offer free win Class
1 2 1 0 Spam
2 0 0 1 Not Spam
3 3 2 1 Spam
4 0 1 2 Not Spam
5 1 0 1 Spam
6 0 1 0 Not Spam
7 2 1 3 Spam
8 1 2 0 Not Spam

Problem 3: Exam Performance Prediction (Gaussian)


Task: Use Gaussian Naive Bayes to compute P (Pass | Math = 65, English = 72).

Student Math English Result


1 85 78 Pass
2 42 60 Fail
3 75 69 Pass
4 58 55 Fail
5 80 70 Pass
6 38 52 Fail
7 65 74 Pass
8 48 58 Fail

Problem 4: Loan Risk Prediction (Missing Values)


Task: Predict P (Risk=Yes | Income=Medium) using marginalization over the missing fea-
ture (Credit Score).

Person Income Credit Score Risk


1 High Good No
2 Medium Bad Yes
3 Low Good Yes
4 Medium Missing Yes
5 High Bad No
6 Low Bad Yes
7 Medium Good No
8 Low Good Yes

2
Problem 5: Customer Churn (Mixed Features)
Task: Predict churn for a new customer with Plan=Silver and Usage=3.5 using mixed
(categorical + Gaussian) Naive Bayes.

Customer Plan Usage Hours Churned


1 Gold 1.5 No
2 Silver 2.0 No
3 Bronze 4.2 Yes
4 Gold 2.5 No
5 Bronze 5.0 Yes
6 Silver 3.7 Yes
7 Gold 2.0 No
8 Bronze 4.5 Yes

Problem 6: Weather Classification (Multiclass)


Task: Compute P (Rainy | Temperature=Mild, Humidity=High).

Day Temperature Humidity Weather


1 Hot High Sunny
2 Mild Low Rainy
3 Mild High Rainy
4 Cool High Cloudy
5 Cool Low Cloudy
6 Hot High Sunny
7 Mild High Rainy
8 Cool Low Cloudy

Problem 7: Language Identification (Multinomial)


Task: Classify the sentence: ”bonjour merci” using Laplace-smoothed Multinomial Naive
Bayes.

3
Sentence bonjour hello gracias merci thanks Language
1 2 0 0 1 0 French
2 0 1 0 0 2 English
3 0 0 3 0 0 Spanish
4 1 0 0 2 0 French
5 0 2 0 0 1 English
6 0 0 2 0 0 Spanish
7 1 0 0 1 0 French
8 0 1 0 0 1 English
9 0 0 1 0 0 Spanish

Problem 8: Fraud Detection (Unbalanced)


Task: Predict fraud for a transaction at Foreign location and Night time. Analyze how class
imbalance affects the result.

Transaction Location Time Fraud


1 Local Day No
2 Local Night No
3 Foreign Night Yes
4 Local Day No
5 Foreign Day Yes
6 Local Night No
7 Foreign Night Yes
8 Local Day No
9 Local Day No
10 Local Night No

Problem 9: Feature Dependency Violation (Conceptual)


Task: Show mathematically how the assumption of independence between Flu and Cough
is violated in this dataset.

4
Case Flu Cough Fever Sick
1 Yes Yes Yes Yes
2 No No No No
3 Yes Yes Yes Yes
4 No Yes Yes Yes
5 Yes Yes No Yes
6 No No No No
7 Yes No Yes Yes
8 No Yes No No

Problem 10: Sentiment Analysis (Multinomial)


Task: Classify the sentence: ”great love boring” using Multinomial Naive Bayes with
Laplace smoothing.

Sentence great awful love boring Label


1 2 0 1 0 Positive
2 0 2 0 1 Negative
3 1 0 2 0 Positive
4 0 1 0 2 Negative
5 1 0 1 0 Positive
6 0 2 0 1 Negative

You might also like