The document discusses the Naive Bayes classifier algorithm for spam detection. It shows how the algorithm calculates the probability that an email is spam based on the presence of words like "buy" and "cheap". It begins with small amounts of sample data that indicate high spam probabilities for individual words. However, it then collects more representative sample data that shows the words actually occur independently, leading to a lower calculated spam probability when both words are present. The document is an example walkthrough of how Naive Bayes modeling works for spam filtering.
Introduction to Naive Bayes classifier presented by Luis Serrano.
Introduction to Bayes Theorem and its mathematical formulation.
Example of spam detection using 100 emails categorizing as spam or no spam. Probability quiz on spam detection related to the word 'buy'. Various probabilities discussed.
Continuing the probability quiz based on emails containing 'buy' with numerical probabilities.
Review of spam detection results focusing on emails containing 'buy'.
Analyzing the probability of emails containing the word 'cheap' being spam.
Further exploration of spam probabilities with focus on the word 'cheap'.
Analysis of emails containing both 'buy' and 'cheap' and their spam probabilities.
Probability quiz involving both 'buy' and 'cheap' in spam detection.
Discussion on issues with spam classification involving 'buy' and 'cheap'.
Exploring data impact on spam detection with numerical data presented.
Analysis of spam emails and their characteristics with varying numerical examples.
Quiz on identifying spam probability for emails containing 'buy' and 'cheap'.
Representing total email characteristics and probabilities based on Naive Bayes.
Extended analysis of email data focusing on predictive probabilities.
Statistical analysis culminating in probability calculations utilizing the Naive Bayes model.
Thank you note encouraging engagement with Luis Serrano's content.
Spam No spam
“Buy”
SpamDetector
Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
12.
Spam No spam
“Buy”
SpamDetector
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
13.
Spam No spam
“Buy”
SpamDetector
60%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
14.
Spam No spam
“Buy”
SpamDetector
60%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
15.
Spam No spam
“Buy”
SpamDetector
60%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
16.
Spam No spam
“Buy”
SpamDetector
20
60%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
17.
Spam No spam
“Buy”
SpamDetector
20 5
60%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
18.
Spam No spam
“Buy”
SpamDetector
20 580% 20%
60%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
19.
Spam No spam
“Buy”
SpamDetector
20 580% 20%
60%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
20.
Spam No spam
“Buy”
SpamDetector
20 580% 20%
60%
Solution:
80%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
21.
Spam No spam
“Buy”
SpamDetector
20 580% 20%
60%
Solution:
80%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
22.
Spam No spam
“Buy”
SpamDetector
20 580% 20%
60%
Solution:
80%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
80%
23.
Spam No spam
“Buy”
20580% 20%
60%
Solution:
80%
80%
40%Quiz: If an e-mail
contains the word “buy”,
what is the probability
that it is spam?
100%
80%
Bayes Theorem
Spam No spam
“Buy”and “Cheap”
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
Spam Detector
52.
Spam No spam
“Buy”and “Cheap”
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
Spam Detector
53.
Spam No spam
“Buy”and “Cheap”
60%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
Spam Detector
54.
Spam No spam
“Buy”and “Cheap”
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
Spam Detector
55.
Spam No spam
“Buy”and “Cheap”
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
56.
Spam No spam
“Buy”and “Cheap”
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
57.
Spam No spam
“Buy”and “Cheap”
12
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
58.
Spam No spam
“Buy”and “Cheap”
12
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
59.
Spam No spam
“Buy”and “Cheap”
012
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
60.
Spam No spam
“Buy”and “Cheap”
00%12100%
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
61.
Spam No spam
“Buy”and “Cheap”
00%12100%
60%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
62.
Spam No spam
“Buy”and “Cheap”
00%12100%
60%
Solution:
100%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
63.
Spam No spam
“Buy”and “Cheap”
00%12100%
60%
Solution:
100%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
Spam Detector
64.
Spam No spam
“Buy”and “Cheap”
00%12100%
60%
Solution:
100%
80%
40%Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
100%
100% ?
Spam Detector
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12 2/312
112.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/312
113.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
114.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
=
38
36
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
115.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
=
38
36
= 94.737%
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
116.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
=
38
36
= 94.737%
94.737%
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
117.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
5.263% =
38
36
= 94.737%
94.737%
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
118.
Spam No spam
SpamDetector
“Buy” and “Cheap”
12 2/3
5.263% =
38
36
= 94.737%
94.737%
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
94.737%
119.
Spam No spam
“Buy”and “Cheap”
12 2/3
5.263% =
38
36
= 94.737%
94.737%
Quiz: If an e-mail
contains the words “buy”
and “cheap”, what is the
probability that it is
spam?
12
2/31212 + 2/3
12
Naive Bayes Classifier
94.737%
P(“Buy” & “Cheap”)= P(“Buy”) P(“Cheap”)
P(B C) = P(B) P(C)
U
Naive Bayes
190.
P(“Buy” & “Cheap”)= P(“Buy”) P(“Cheap”)
Naive
P(B C) = P(B) P(C)
U
Naive Bayes
191.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
192.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
193.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
194.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
195.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
15
25
196.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
15
25
197.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
15
25
198.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
15
25
15
25
199.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
25
100
15
25
15
25
200.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
25
100
+
15
25
15
25
201.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
25
100
5
75
+
15
25
15
25
202.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
25
100
5
75
+
15
25
15
25
10
75
203.
Naive BayesS: Spam
H:Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
25
100
5
75
75
100
+
15
25
15
25
10
75
204.
= 94.737%
Naive BayesS:Spam
H: Ham (not spam)
B: ‘Buy’
C: ‘Cheap’
P(S B C) =
P(S)
P(S) + P(H)
U P(B C S)
U
P(B C S)
U
P(B C H)
U
P(B S)P(C S)
P(B S)P(C S) P(B H)P(C H)
P(spam if “Buy” & “Cheap”) =
20
25
25
100
20
25
25
100
5
75
75
100
+
15
25
15
25
10
75