Problem 2: Spam Email Classification
Sender
Domain
(Nominal)
Email Length
(Continuous)
Attachment
(Nominal)
Spam Link
Count
(Discrete)
Urgency
Level
(Ordinal)
Is
Spam
Sample
1
example.com
1323
No
0
Low
No
2
spammer.net
542
Yes
3
High
Yes
3
legitimate.org
981
No
1
Medium
No
4
example.com
698
Yes
5
High
Yes
5
legitimate.org
1234
No
0
Low
No
6
spammer.net
322
No
2
Medium
Yes
7
example.com
657
No
1
Medium
No
8
spammer.net
987
Yes
4
High
Yes
9
legitimate.org
445
No
0
Low
No
10
legitimate.org
1298
Yes
6
High
Yes
You are tasked with classifying emails as spam or not spam using Naive Bayes classification. You
need to estimate the conditional probabilities for different attributes and the class variable "Is
Spam."
Exercises:
1. Calculate Prior Probabilities: Calculate the prior probabilities of an email being spam or
not spam based on the provided dataset.
2. Conditional Probabilities for Nominal Attributes: Calculate the conditional probabilities
of an email being spam or not spam for different sender domains (Nominal attribute).
3. Conditional Probabilities for Continuous Attributes: Calculate the conditional
probabilities of an email being spam or not spam based on the email length (Continuous
attribute). You can assume a Gaussian distribution.
4. Conditional Probabilities for Nominal Attributes with Multiple Categories: Calculate the
conditional probabilities of an email being spam or not spam based on whether it has an
attachment (Nominal attribute).
5. Conditional Probabilities for Discrete Attributes: Calculate the conditional probabilities
of an email being spam or not spam based on the number of spam links (Discrete
attribute).
6. Conditional Probabilities for Ordinal Attributes: Calculate the conditional probabilities of
an email being spam or not spam based on the urgency level (Ordinal attribute).
7. Spam Classification: Given a new email with the following attributes, use Naive Bayes to
classify it as spam or not spam:
Sender Domain: "spammy.biz"
Email Length: 765
Attachment: Yes
Spam Link Count: 2
Urgency Level: Medium
These exercises will help you practice estimating probabilities for a Naive Bayes
classification problem with different types of attributes.