### CS 124 / LING 180 From Languages to Information, Dan Jurafsky, Winter 2017 Week 3: Group Exercises on Text Cat/NB/Sentiment Jan 31, 2017

1. Part 1: Group Exercise

We want to build a naive bayes sentiment classifier using add-1 smoothing, as described in the lecture (not binary naive bayes, regular naive bayes). Here is our training corpus:

Training Set:

```    - just plain boring
- entirely predictable and lacks energy
- no surprises and very few laughs
+ very powerful
+ the most fun film of the summer
```

Test Set:

```    predictable with no originality
```

Compute the prior for the two classes + and -, and the likelihoods for each word given the class (leave in the form of fractions). Then compute whether the sentence in the test set is of class positive or negative (you may need a computer for this final computation). Make sure you know the correct the Bayes equation to use to compute a value for each class in order to answer this question. What would the answer be without add-1 smoothing? (Optional: would using binary multinomial Naive Bayes change anything?)

Part 2: Challenge Problems

1. Go to the Sentiment demo at http://nlp.stanford.edu:8080/sentiment/rntnDemo.html. Come up with 5 sentences that the classifier gets wrong. Can you figure out what is causing the errors?

2. Binary multinomial NB seems to work better on some problems than full count NB, but full count works better on others. For what kinds of problems might binary NB be better, and why? (There is no known right answer to this question, but I'd like you to think about the possibilities.)