Classic models
Naive Bayes text classification, lexicon and classifier approaches to sentiment with proper evaluation, and n-gram language models with smoothing and perplexity.
About 5 hours of study
Learning objectives
- Train and apply Naive Bayes with smoothing
- Score and evaluate sentiment with precision, recall and F1
- Build, smooth and evaluate n-gram language models
Lessons
- 1
Naive Bayes text classification Intermediate
Classify text with multinomial Naive Bayes: estimate class priors and word likelihoods from counts, smooth them with add-one, and add log probabilities to pick the most likely class. Build a spam filter from scratch.
- 2
Sentiment analysis Intermediate
Decide whether text is positive or negative: score words with a sentiment lexicon, handle negation and intensifiers, compare rules with trained classifiers, and measure the results with precision, recall and F1.
- 3
Language models and smoothing Intermediate
A language model gives every sentence a probability. Build bigram models from counts with sentence markers, see why unseen word pairs break maximum-likelihood estimates, fix them with add-one and add-k smoothing, measure models with perplexity and generate text.
Module practice
- NLP: Priors and word likelihoodsEasy
- NLP: Train and apply Naive BayesMedium
- NLP: Evaluate a text classifierHard
- NLP: Score sentiment with a lexiconEasy
- NLP: Negation and intensifiersMedium
- NLP: Precision, recall and F1Hard
- NLP: Bigram probabilitiesEasy
- NLP: Add-k smoothed sentence probabilityMedium
- NLP: Compare models by perplexityHard