Logistic Regression and Text Classification
Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 4
3 cards in “4.10 Test sets and cross-validation” · whole deck
4.10 Test sets and cross-validation
- What problem does cross-validation solve?With fixed training/dev/test splits, the test or dev set may be too small to be representative. Cross-validation lets all the data be used for both training and testing.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 4, §4.10, p. 116
- How does \(k\)-fold cross-validation work?Partition the data into \(k\) disjoint folds. For each fold, train on the other \(k-1\) folds and measure the error on that fold; average the \(k\) error rates. With \(k = 10\), 10 models are each trained on 90% of the data.
Common practice: cross-validate inside the training data, keep a separate test set. - Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 4, §4.10, p. 116
- Why is cross-validation usually done only inside the training set, with a separate test set?If all data is used for testing, the whole corpus must stay blind: you couldn’t look at any of it to design features without peeking at test data. A fixed test set lets you inspect the training data.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 4, §4.10, p. 116
Source
- Daniel Jurafsky and James H. Martin. Speech and Language Processing. 3rd edition (draft). https://web.stanford.edu/~jurafsky/slp3/