Lesson 3: Naive Bayes, the first trained intent classifier
54 min read·14 Oct 2026
Module 4 · Lesson 3 · About 45 minutes · Needs: basic Python; Module 2 Lesson 3 helps (word tokens) but is not required
The situation
It is Monday 28 September 2026, project week 4. The keyword router from Module 1 scores 0.438 on HARD_TEST, the 80 hand-written messages. Every new keyword Ines suggests fixes one message and breaks another.
Rosa asks: Ines has labelled 1,800 messages (simulated), so can the computer work out the keywords itself? It can. This lesson builds naive Bayes, first by hand and then with scikit-learn, and scores it on the same 80 messages.