← Speech and Language Processing
NLP›Popular Textbooks› SLP · Chapter 4

Chapter 4

Logistic Regression for Text: From Word Counts to a Decision

Chapter: Logistic Regression and Text Classification, in Daniel Jurafsky and James H. Martin, Speech and Language Processing, 3rd edition draft, August 19, 2026.

Topics to learn

Page numbers refer to the linked chapter PDF.

FAQ

Why does the binary logistic gradient simplify to (p - y) times the feature?

The loss derivative with respect to the probability, times the sigmoid derivative, cancels to p - y. The feature then scales how much that weight contributed to the logit.

Does changing the decision threshold change cross-entropy?

No. The probabilities stay fixed, so the probability loss stays fixed. The threshold changes labels, and therefore precision, recall, and F1.

What is a paired bootstrap checking?

Whether a score difference on the same test items is large relative to differences you get by resampling those items. It is not a substitute for a fresh test set.

Can a high accuracy still be a harmful classifier?

Yes. Errors, labels, and features can fall unevenly across groups. The chapter treats that as a separate evaluation question from the average score.