In development

This website is still being developed and updated.

← All projects

Post Text Classifier

A C++ classifier that learns from labeled discussion posts and predicts the topic of a new post using word evidence and probability.

01 / From text to predictionChoose a sample to follow the words through the classifier.

Overview

Inspired by Piazza discussions, this project turns labeled posts into a model that can recognize the topic of a new discussion. Labels come from the training data, so the classifier can work with different sets of topics.

The C++ implementation handles training, prediction, and evaluation. The interactive animation above illustrates its scoring process with a small example corpus in the browser.

How it works

  1. Learn from labeled posts. Read CSV training data and count posts per label, unique vocabulary, and the number of posts containing each word.
  2. Keep unique words. Treat each post as a bag of words. Word order and repeated occurrences do not change the prediction.
  3. Score each topic. Combine the label’s log prior with the words’ log likelihoods. Fallback estimates handle words unseen within a label or across the training set.
  4. Choose the highest score. Predict the most likely label, then compare predictions with known labels when evaluating a test dataset.

Built with sets and maps

Sets deduplicate the words in each post. Maps keep track of label totals and word frequencies, making those counts available during training and prediction. Log-probability scoring keeps the calculations manageable as evidence accumulates.

Explore the animation

Try Garden, Code, and Design to see how different words shift the scores. The Unknown sample introduces an unfamiliar word and shows how the fallback rule contributes to the result. Pause or replay the animation to inspect each stage.

Next featured projectAprilTag Odometry Verification System