CourseNatural Language Processing: The Complete Course · Module 5: Evaluation, Sentiment and Topics · part 34 of 73
Part 34 · Module 5: Evaluation, Sentiment and Topics

Lesson 2: Cross-validation, tuning and messages that fit nowhere

58 min read·14 Oct 2026
Module 5 · Lesson 2 · About 55 minutes · Needs: basic Python; Lesson 1 of this module (precision, recall and macro F1) helps, but this lesson builds the model it tests

The situation

It is Wednesday 7 October 2026, project week 5. Rosa wants the intent router to run on its own, with Ines checking only what it sends her. Ines has three conditions: an honest score, not one tuned until it looks good; praise and spam, the smallest intents, not ignored; and when the model is unsure, or a message fits no intent, it passes the message to her.

The running example is HT15, hand-written and labelled praise: "Bike is lovely, delivery was a nightmare. Overall happy though, thanks Ines." Lesson 1's model sent it to repair_booking. All data is simulated.

HT15, HAND-WRITTEN, LABELLED PRAISE "Bike is lovely, delivery was a nightmare. Overall happy though, thanks Ines." a message any language router seven intents sure: route it Dev, Callum or Ines unsure or no fit abstain: to Ines
Ines's conditions for an unattended router (blue: the normal path; amber: anything uncertain): route what it is sure of, and send her what it is unsure of or what fits no intent.

The rest of this part opens with an account

Signing up is free and takes one email. Nothing to pay, and nothing renews.