Classifier reference
August 15, 2026 ยท View on GitHub
Feature reference for the classifier gem. Every example here runs against the
version in this repository.
The README gives the short tour. These pages give the detail.
Command line
| Page | Contents |
|---|---|
| classifier | Train, classify, and manage models from the shell |
| keywords | TF-IDF keyword extraction and term scores |
Classifiers
| Page | Use it for |
|---|---|
| Bayes | Fast probabilistic classification. The default choice |
| Logistic Regression | Linear classification with calibrated probabilities |
| LSI | Semantic similarity, search, related documents, and summaries |
| k-Nearest Neighbors | Classification with the nearest examples and their votes |
Vectorization
| Page | Contents |
|---|---|
| TF-IDF | Term weights, n-grams, document frequency filters |
Shared behavior
| Page | Contents |
|---|---|
| Persistence | Save, load, storage backends, and custom backends |
| Streaming | Training on data larger than memory |
| Configuration | Global settings and the native extension |
Which classifier
Start with Bayes. It trains in one pass, needs no fit step, and handles most text classification tasks.
- Choose Logistic Regression when you need a probability per category, and
you accept a
fitstep after training. - Choose LSI when you need similarity, search, or related documents, and not only a label.
- Choose k-Nearest Neighbors when you want to see which examples drove the answer.
- Choose TF-IDF when you want term weights rather than a category.