Mahdi Rizk

EECS 298, Project Studio

Naive Bayes Sentiment and Emotion Classifier

Bag-of-words text classifiers trained on IMDB movie reviews to predict positive or negative sentiment, plus a multi-class extension that predicts emotion labels.

WhenFall 2024
TypeCoursework
CourseEECS 298

What I built

  • Implemented a Bernoulli-style Naive Bayes classifier with add-one (Laplace) smoothing, scoring each review with summed log probabilities over its unique words.
  • Compared it against a vocabulary-count baseline and a null classifier behind a shared abstract Classifier interface, and reported a confusion matrix and accuracy on 1000 held-out reviews after training on 10,000.
  • Wrote an accuracy-vs-training-size experiment that trained each classifier on 1, 2, 4, up to 32,768 examples and wrote the results to CSV.
  • Extended the model to multiple classes with a per-emotion word probability table and argmax over log posteriors, backing off to the smoothed floor for words unseen in one class.