CourseNatural Language Processing: The Complete Course · Module 4: Text as Vectors and Classification · part 29 of 73
Part 29 · Module 4: Text as Vectors and Classification

Lesson 4: Logistic regression: weighted evidence you can read

56 min read·14 Oct 2026
Module 4 · Lesson 4 · About 50 minutes · Needs: basic Python; Lessons 1 to 3 of this module help (word counts, TF-IDF, naive Bayes) but are not required

The situation

It is Monday 28 September 2026, project week 4. The rule router from Module 1 is still the only thing routing Tidewell's inbox, and on Ines's 80 hand-written test messages it is right less than half the time. Rosa wants a trained classifier that beats it. Ines adds a condition: when the model sends a message to Dev or Callum, she wants to see why.

One message runs through the lesson: HT35 from the hand-written test set (simulated). It reads "Charged twice. £45 and £45. Fix it." Ines labels it returns_refund. The rule router sends it to order_status, because none of its keywords appears.

THE RULE ROUTER, MODULE 1 template test 0.878 HARD_TEST 0.438 HT35: no keyword fires sent to order_status, the fallback
The baseline to beat: the rule router scores 0.878 on template messages but 0.438 on the hand-written HARD_TEST, and it sends HT35 to the fallback (blue: the normal path; red: failure).

The rest of this part opens with an account

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