Personal project · public or synthetic data
Product categorisation
100 categories in a 184-node taxonomy, with confidence routing to a human. The cheap model won.
Key results
- accuracy, TF-IDF + linear SVM
- 0.869
- accuracy, fine-tuned XLM-RoBERTa
- 0.849
- hierarchical F1
- 0.932
- auto-categorised at a 95 % target
- 82 %
100 categories, and when to trust the model
Assign each e-commerce product (title, description, brand, colour; mostly French) to one of 100 leaf categories of a 184-node taxonomy, and decide when the prediction is safe enough to publish without a human. It started as a technical-assignment notebook and became a package with validation, two models, hierarchical metrics, routing, an API and tests.
The cheap model won
On the official test set (7,631 products): TF-IDF + linear SVM reaches accuracy 0.869 and macro-F1 0.839, ahead of the notebook baseline (0.842) and of XLM-RoBERTa fine-tuned for 6 epochs (0.849). Product titles are short and full of brands, model numbers and units, where character n-grams are hard to beat.
Errors stay close in the tree: the first two levels of the path are right 97.6 % and 96.5 % of the time. With a threshold calibrated on validation, 82 % of products are published automatically at 94.6 % accuracy; the rest go to a human with the deepest confident category.

Checks along the way
Leakage checked: 131 test products share an exact title with a training product; scores without them are identical (0.8693 vs 0.8691).
A GPU memory bug found by timing: epoch 2 took 33 min against 15 for epoch 1, because the best weights were copied on the GPU; they are now copied to CPU.
The served model is chosen on validation macro-F1, never on test.
Data that is not mine to share
The dataset belongs to the assignment provider and is not public, so the trained TF-IDF model is shared on request only (its vocabulary contains words from the private data).