### Bayes theorem and Naive Bayes algorithm

1. Naive Bayes
2. Luis Serrano Naive Bayes Classiﬁer
3. Bayes Theorem P(A B) = P(B A) P(B A) P(A) P(A)+ P(B Ac )P(Ac )
4. 3. Bayes Theorem
5. Spam Detector 100 e-mails
6. Spam No spam Spam Detector 25 75
7. Spam No spam “Buy” Spam Detector 25 75
8. Spam No spam “Buy” Spam Detector 25 75
9. Spam No spam “Buy” Spam Detector 25 75
10. Spam No spam “Buy” Spam Detector
11. Spam No spam “Buy” Spam Detector Quiz: If an e-mail contains the word “buy”, what is the probability that it is spam?
12. Spam No spam “Buy” Spam Detector 40%Quiz: If an e-mail contains the word “buy”, what is the probability that it is spam?
13. Spam No spam “Buy” Spam Detector 60% 40%Quiz: If an e-mail contains the word “buy”, what is the probability that it is spam?
14. Spam No spam “Buy” Spam Detector 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” Spam Detector 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” Spam Detector 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” Spam Detector 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” Spam Detector 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” Spam Detector 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” Spam Detector 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” Spam Detector 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” Spam Detector 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” 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% Bayes Theorem
24. Spam No spam Spam Detector
25. Spam No spam Spam Detector “Cheap”
26. Spam No spam Spam Detector “Cheap”
27. Spam No spam Spam Detector “Cheap”
28. Spam No spam “Cheap” Bayes Theorem
29. Spam No spam “Cheap” Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? Bayes Theorem
30. Spam No spam “Cheap” 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? Bayes Theorem
31. Spam No spam “Cheap” 60% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? Bayes Theorem
32. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? Bayes Theorem
33. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 100% Bayes Theorem
34. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 100% Bayes Theorem
35. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 100% Bayes Theorem
36. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 100% Bayes Theorem
37. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 15 100% Bayes Theorem
38. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 15 10 100% Bayes Theorem
39. Spam No spam “Cheap” 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 15 1060% 40% 100% Bayes Theorem
40. Spam No spam “Cheap” 60% Solution: 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 15 1060% 40% 100% Bayes Theorem
41. Spam No spam “Cheap” 60% Solution: 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 15 1060% 40% 100% Bayes Theorem
42. Spam No spam “Cheap” 60% Solution: 60% 80% 40%Quiz: If an e-mail contains the word “cheap”, what is the probability that it is spam? 15 1060% 40% 100% 60% Bayes Theorem
43. Spam No spam Spam Detector “Buy” and “Cheap”
44. Spam No spam Spam Detector “Buy” and “Cheap”
45. Spam No spam Spam Detector “Buy” and “Cheap”
46. Spam No spam Spam Detector “Buy” and “Cheap”
47. Spam No spam Spam Detector “Buy” and “Cheap”
48. Spam No spam Spam Detector “Buy” and “Cheap”
49. Spam No spam Spam Detector “Buy” and “Cheap”
50. Spam No spam “Buy” and “Cheap” Spam Detector
51. 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
65. Problem Spam No spam “Buy” and “Cheap”
66. Problem Spam No spam “Buy” and “Cheap” 12 e-mails
67. Problem Spam No spam “Buy” and “Cheap” 12 e-mails 0 e-mails?
68. Solution: Collect more data?
69. Solution: Collect more data?
70. Solution: Collect more data?
71. Spam Detector Spam No spam “Buy” and “Cheap” 12 e-mails 0 e-mails?
72. Spam Detector Spam No spam “Buy” and “Cheap” 12 e-mails 0 e-mails? Guess?
73. Spam Detector
74. Spam Detector 100 e-mails
75. Spam Detector 100 e-mails 5 “Buy”
76. Spam Detector 100 e-mails 5 “Buy”
77. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap”
78. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap”
80. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap” 5% “Buy” 10% “Cheap”
81. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap” 5% “Buy” 10% “Cheap”
82. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap” 5% “Buy” 10% “Cheap” 0.5% “Buy” and “Cheap”
83. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap” 5% “Buy” 10% “Cheap” 0.5% “Buy” and “Cheap”
84. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap” 5% “Buy” 10% “Cheap” 0.5% “Buy” and “Cheap” Independent
85. Spam Detector 100 e-mails 5 “Buy” 10 “Cheap” 5% “Buy” 10% “Cheap” 0.5% “Buy” and “Cheap” Independent That’s naive!
86. Spam Spam Detector
87. Spam Spam Detector 25 e-mails
88. Spam Spam Detector 25 e-mails
89. Spam Spam Detector 25 e-mails 20 “Buy”
90. Spam Spam Detector 25 e-mails 20 “Buy” 4/5
91. Spam Spam Detector 25 e-mails 20 “Buy” 4/5
92. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5
93. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5 3/5
94. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5 3/5
95. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5 3/5 12/25
96. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5 3/5 12/25 x 25
97. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5 3/5 12/25 = 12 “Buy” and “Cheap”x 25
98. Spam Spam Detector 25 e-mails 20 “Buy” 15 Cheap 4/5 3/5 12/25 = 12 “Buy” and “Cheap”x 25
99. No spam Spam Detector
100. No spam Spam Detector 75 e-mails
101. No spam Spam Detector 75 e-mails 5 “Buy”
102. No spam Spam Detector 75 e-mails 5 “Buy” 1/15
103. No spam Spam Detector 75 e-mails 5 “Buy” 10 “Cheap” 1/15
104. No spam Spam Detector 75 e-mails 5 “Buy” 10 “Cheap” 1/15 2/15
105. No spam Spam Detector 75 e-mails 5 “Buy” 10 “Cheap” 1/15 2/15 2/225
106. No spam Spam Detector 75 e-mails 5 “Buy” 10 “Cheap” 1/15 2/15 2/225 x 75
107. No spam Spam Detector 75 e-mails 5 “Buy” 10 “Cheap” 1/15 2/15 2/225 = 2/3 “Buy” and “Cheap”x 75
108. No spam Spam Detector 75 e-mails 5 “Buy” 10 “Cheap” 1/15 2/15 2/225 = 2/3 “Buy” and “Cheap”x 75
109. Spam No spam Spam Detector “Buy” and “Cheap” 12 2/3
110. Spam No spam Spam Detector “Buy” and “Cheap” 12 2/3
111. Spam No spam Spam Detector “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 Spam Detector “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 Spam Detector “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 Spam Detector “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 Spam Detector “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 Spam Detector “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 Spam Detector “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 Spam Detector “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 Classiﬁer 94.737%
120. Naive Bayes Spam No spam
121. Total Buy Cheap Buy & Cheap Naive Bayes Spam No spam
122. Total Buy Cheap Buy & Cheap 25 Naive Bayes Spam No spam
123. Total Buy Cheap Buy & Cheap 25 75 Naive Bayes Spam No spam
124. Total Buy Cheap Buy & Cheap 25 75 20 Naive Bayes Spam No spam
125. Total Buy Cheap Buy & Cheap 25 75 20 4/5 Naive Bayes Spam No spam
126. Total Buy Cheap Buy & Cheap 25 75 20 4/5 5 Naive Bayes Spam No spam
127. Total Buy Cheap Buy & Cheap 25 75 20 4/5 5 1/15 Naive Bayes Spam No spam
128. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 5 1/15 Naive Bayes Spam No spam
129. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 5 1/15 Naive Bayes Spam No spam
130. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 5 10 1/15 Naive Bayes Spam No spam
131. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 5 10 1/15 2/15 Naive Bayes Spam No spam
132. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 5 10 1/15 2/15 Naive Bayes Spam No spam
133. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
134. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
135. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
136. Total Buy Cheap Buy & Cheap 25 75 20 15 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
137. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
138. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
139. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 Naive Bayes Spam No spam
140. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 2/225 Naive Bayes Spam No spam
141. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 2/225 Naive Bayes Spam No spam
142. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 2/225 Naive Bayes Spam No spam
143. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 1/15 2/15 2/225 Naive Bayes Spam No spam
144. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 Naive Bayes Spam No spam
145. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 Naive Bayes Spam No spam
146. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 Naive Bayes Spam No spam
147. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 Naive Bayes Spam No spam
148. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 12 + 2/3 12 Naive Bayes Spam No spam
149. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 = 38 36 12 + 2/3 12 Naive Bayes Spam No spam
150. Total Buy Cheap Buy & Cheap 25 75 20 15 12 4/5 3/5 12/25 5 10 2/3 1/15 2/15 2/225 = 38 36 = 94.737% 12 + 2/3 12 Naive Bayes Spam No spam
151. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 Naive Bayes
152. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 Naive Bayes
153. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 30 Naive Bayes
154. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 Naive Bayes
155. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 Naive Bayes
156. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 Naive Bayes
157. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/125 Naive Bayes
158. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/125 Naive Bayes
159. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/125 Naive Bayes
160. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/125 Naive Bayes
161. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 Naive Bayes
162. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 Naive Bayes
163. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 Naive Bayes
164. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 12/3375 Naive Bayes
165. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 12/3375 Naive Bayes
166. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 12/3375 Naive Bayes
167. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 12/3375 Naive Bayes
168. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 4/15 12/3375 Naive Bayes
169. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 4/15 12/3375 Naive Bayes
170. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 4/15 12/3375 Naive Bayes
171. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 12/125 4/15 12/3375 Naive Bayes
172. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 12/5 + 4/15 12/5 12/5 12/125 4/15 12/3375 Naive Bayes
173. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 = 40 36 12/5 + 4/15 12/5 12/5 12/125 4/15 12/3375 Naive Bayes
174. Total Buy 20 4/5 5 1/15 Cheap 15 3/5 10 2/15 Work Buy, Cheap, & Work Spam No Spam 25 75 5 1/5 30 6/15 = 40 36 = 90% 12/5 + 4/15 12/5 12/5 12/125 4/15 12/3375 Naive Bayes
175. 4. The math
176. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’
177. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) =
178. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) =
179. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25
180. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100
181. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100 20 25
182. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100 20 25 25 100
183. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100 20 25 25 100 +
184. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100 20 25 25 100 5 75+
185. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100 20 25 25 100 5 75 75 100+
186. Bayes Theorem P(S B) = P(B S) P(B S) P(S) P(S)+P(B H)P(H) S: Spam H: Ham (not spam) B: ‘Buy’ P(spam if “Buy”) = 20 25 25 100 20 25 25 100 5 75 75 100+ = 80%
187. Naive Bayes
189. 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
205. Thank you!
206. Thank you! Subscribe, like, share, comment youtube.com/c/LuisSerrano
207. Thank you! @luis_likes_math Subscribe, like, share, comment youtube.com/c/LuisSerrano
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}