Sentiment Analysis and Text Classification — lecture notes
Is this review positive or negative? See how word evidence adds up, why negation is tricky, and how modern classifiers are built.
0:001. Introduction

Companies read thousands of reviews and comments every day. Sentiment analysis, a kind of text classification, tells them automatically whether people are happy or not.
0:112. Adding up evidence

A simple classifier gives each word a weight. Delicious pushes strongly towards positive. Slow and rude push towards negative. The weights add up, and a sigmoid turns the total into a probability. But look at the last sentence. Not bad at all is actually positive, yet word by word it looks negative. Negation is hard.
0:343. The recipe

The recipe: collect labelled texts, turn them into features, TF-IDF or embeddings from a pre-trained model, train a classifier, and evaluate it on held-out data.
0:454. Classic vs modern

Classic models are fast and explainable, but miss negation and sarcasm. Fine-tuned Transformer models read words in context, so they understand that not bad means good.
0:575. Uses

Text classification powers review analysis, spam and toxicity filters, routing emails and support tickets, and tracking public opinion.
1:066. Recap

To recap. Sentiment analysis classifies feelings. Word evidence adds up into a probability, context handles negation, and fine-tuned Transformers are today’s standard.
Key takeaways
- Sentiment analysis is text classification into positive/negative (or more classes).
- Simple models add word weights and apply a sigmoid.
- Negation (“not bad”) and sarcasm require context.
- Fine-tuned Transformers handle context far better than bag-of-words models.
Check yourself
- Why is “Not bad at all” difficult for a word-weight model?
Show answer
Individual words look negative but the phrase is positive — Negation flips meaning; context is needed.
- What turns the summed word weights into a probability?
Show answer
A sigmoid — The sigmoid squashes the total into 0–1.
- Which approach best understands context?
Show answer
A fine-tuned Transformer model — Transformers represent words in context.
Go deeper
- Sentiment Analysis: Opinions, Aspects and Nuance · The AI Lecture Hall
- Text Classification: From Linear Models to Fine-Tuned Transformers · The AI Lecture Hall
- Fine-Tuning Pretrained Language Models: A Practical Guide · The AI Lecture Hall
© 2026 Janin A Apurba, CSE, AUST · Advanced ICT Officer, CNRS-UNHCR. All rights reserved. Notes for the animated lecture at https://ai-in-motion.vercel.app/watch/sentiment-and-text-classification.html