Text Classification: Slides Adapted From Lyle Ungar and Dan Jurafsky
Text Classification: Slides Adapted From Lyle Ungar and Dan Jurafsky
• Naïve Bayes
• Logistic Regression
• Support-vector machines
• K-Nearest Neighbors
• Neural Networks
Text Classification: Naïve Bayes
xi = wi, word
Priors:
Example
Class
c0
c0
c0
c1
?
Priors:
P(c0)=3/4
P(c1)=1/4
Example
Class
c0
c0
c0
c1
?
Conditional Probabilities:
Example
Class
c0
c0
c0
c1
?
Conditional Probabilities:
P(Chinese|c0)=(5+1)/(8+6)=6/14=3/7 P(Chinese|c1)=(1+1)/(3+6)=2/9
P(Tokyo|c0)=(0+1)/(8+6)=1/14 P(Tokyo|c1)=(1+1)/(3+6)=2/9
P(Japan|c0)=(0+1)/(8+6)=1/14 P(Japan|c1)=(1+1)/(3+6)=2/9
Example
Class
c0
c0
c0
c1
?
Choosing a class
P(c0|d5)
P(c1|d5)
Summary