Professional Documents
Culture Documents
DMML2023 Lecture06 24jan2023
DMML2023 Lecture06 24jan2023
Pranabendu Misra
slides by Madhavan Mukund
As before
Attributes {A1 , A2 , . . . , Ak } and
Classes C = {c1 , c2 , . . . cℓ }
As before
Attributes {A1 , A2 , . . . , Ak } and
Classes C = {c1 , c2 , . . . cℓ }
As before
Attributes {A1 , A2 , . . . , Ak } and
Classes C = {c1 , c2 , . . . cℓ }
As before
Attributes {A1 , A2 , . . . , Ak } and
Classes C = {c1 , c2 , . . . cℓ }
Likelihood
Actual coin toss sequence is τ = t1 t2 . . . tN
Given an estimate of θ, compute Pr (τ | θ) — likelihood L(θ)
Likelihood
Actual coin toss sequence is τ = t1 t2 . . . tN
Given an estimate of θ, compute Pr (τ | θ) — likelihood L(θ)
Pr (A1 = a1 , . . . , Ak = ak | C = ci ) · Pr (C = ci )
=
Pr (A1 = a1 , . . . , Ak = ak )
Pr (A1 = a1 , . . . , Ak = ak | C = ci ) · Pr (C = ci )
=
Pr (A1 = a1 , . . . , Ak = ak )
Pr (A1 = a1 , . . . , Ak = ak | C = ci ) · Pr (C = ci )
= Pℓ
j=1 Pr (A1 = a1 , . . . , Ak = ak | C = cj ) · Pr (C = cj )
Pr (A1 = a1 , . . . , Ak = ak | C = ci ) · Pr (C = ci )
=
Pr (A1 = a1 , . . . , Ak = ak )
Pr (A1 = a1 , . . . , Ak = ak | C = ci ) · Pr (C = ci )
= Pℓ
j=1 Pr (A1 = a1 , . . . , Ak = ak | C = cj ) · Pr (C = cj )
Hence, predict C = t
Pranabendu Misra Lecture 6: 24 January, 2023 DMML 2023 6 / 19
Example . . .
Final classification is
k
Y
arg max Pr (C = ci ) Pr (Aj = aj | C = ci )
ci
j=1
However, naive Bayes classifiers work well in practice, even for text
classification!
Many spam filters are built using this model
Hence predict C = t
Pranabendu Misra Lecture 6: 24 January, 2023 DMML 2023 10 / 19
Zero counts
As before
Each topic c has probability Pr (c)
Each word wi ∈ V has conditional probability Pr (wi | cj ) with respect to each
cj ∈ C (but we will estimate these differently)
m
X
Note that Pr (wi | cj ) = 1
i=1
Assume document length is independent of the class