72 short synthetic tweets (24 per class, in the spirit of the ~27k-tweet dataset in the article) are tokenised and turned into vectors along 3 chosen vocabulary words, so the resulting 3D point cloud can be watched directly instead of a real 5,000-dimension space.
Bag-of-Words: x_w(d) = count(w, d)
TF-IDF: x_w(d) = count(w, d) ยท log(N / df(w))
nearest-centroid classify(d):
argmin_c โx(d) โ mean_{d' in c}(x(d'))โ
- Bag-of-Words / TF-IDF โ recomputes every tweet's position; BoW axes scale with raw word frequency, TF-IDF shrinks axes for words that appear in most tweets (high document frequency
df) and stretches axes for rarer, more distinctive words.
- Axis words โ which 3 vocabulary words become the X/Y/Z axes; the diamonds are each class's centroid.
- Misclassified only โ dims every tweet whose nearest centroid disagrees with its true label, and draws a line to the wrong centroid it fell into.
- Accuracy / weighted F1 โ computed live from this toy nearest-centroid classifier on the 72-tweet sample; a real Random Forest on the full corpus (per the article) gets 68.9% on BoW and 69.8% on TF-IDF โ a modest, not dramatic, gain, which this mini classifier tends to echo.
Real-world relevance: this is exactly the vectorisation step every classic sentiment-analysis pipeline runs before a Logistic Regression, Decision Tree or Random Forest ever sees the data โ the choice of BoW vs TF-IDF changes the geometry the classifier has to work with, not just a preprocessing footnote.