Intermediate level · Module 7: Sentiment Analysis · Lesson 3 of 3
Comparing Lexicon, Trained and Pretrained Sentiment Models
Learners compare VADER, their trained classifier and a pretrained English transformer sentiment model on the gold test set, with separate results for local and mixed-language messages.
In this lesson you will
- Compare sentiment approaches fairly
- Report results by language and message type
Key concepts
lexicon baselinetrained modelpretrained transformer pipelineper-language resultscost and offline use
The lesson
Three approaches can be compared on the same gold test set: VADER (no training), the trained TF-IDF model (needs labels) and a pretrained English sentiment model from the Hugging Face Hub, loaded with transformers.pipeline('sentiment-analysis', model=...).
Report results separately for English, Juba Arabic and mixed messages. Pretrained English models are often strongest on English text but may fail on local-language messages. A small trained model can do better on local data if it was trained on local examples.
Consider practical costs: the pretrained model needs more memory and a one-time download, while the TF-IDF model is small and fast on any laptop.
Step by step
- Run all three approaches on the gold test set.
- Compute macro F1 for each, overall and by language group.
- Measure prediction time per 100 messages on a lab laptop.
- Recommend an approach for the project and justify it.
Practice activity
Write a comparison table and a recommendation for the project's sentiment component.
Expected result: A fair comparison by language group, with speed and a reasoned recommendation.
Check your understanding
-
Why report sentiment results by language?
Show answer
Models can work well on English and poorly on local-language messages.
-
Name one practical advantage of a TF-IDF model over a pretrained transformer.
Show answer
It is small and fast and runs easily offline on modest laptops.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.