Text classification · fastText
text-classificationfasttextnlpsupervised-learningn-gramshierarchical-softmax
Abstraction: Tutorial for training supervised text classifiers with fastText
Key points:
- fastText supervised classifier trained with
supervisedsubcommand; default parameters yield P@1=0.124 on cooking StackExchange (15k examples, 734 labels) - Tuning epoch=25, lr=1.0, wordNgrams=2 raises P@1 to 0.599 — nearly 5x improvement over defaults
- Key hyperparameters: epochs (standard range 5-50), learning rate (0.1-1.0), word n-gram size (1-5)
- Hierarchical softmax (
-loss hs) approximates softmax via a Huffman tree, achieving ~30x training speedup with modest accuracy trade-off - Multi-label classification via one-vs-all loss (
-loss ova) treats each label as an independent binary classifier - Preprocessing (lowercasing, punctuation spacing) reduced vocabulary from 14k to 9k tokens and improved precision ~4%
Connections: Fasttext · Meta · Text Classification · Supervised Learning · N Grams
Source: https://fasttext.cc/docs/en/supervised-tutorial.html