← Back to selected work
Machine learning / NLPPublic source & report

Food Hazard Detection

Finding an effective text-classification pipeline for imbalanced food-recall data.

Machine-learning project · Feature engineering, experiments and evaluationPython / scikit-learn / TF-IDF / LinearSVC / NLP
The context

SemEval-2025 Task 9 requires predicting a hazard category and a product category from recall reports. The repository reports a final Subtask 1 score of 0.78003.

View repository ↗
How it connects

The workflow.

  1. 01Recall text
  2. 02Word / char TF-IDF
  3. 03LinearSVC
  4. 04Hazard + product labels

The final pipeline combines text features, title boosting and country information for classification.

Engineering details

Inside the work.

01

Start with an interpretable baseline

Established a TF-IDF and logistic-regression baseline before comparing stronger statistical and neural approaches.

02

Features suited to the domain

Combined word and character n-grams with title boosting. Country one-hot features were added to the product-category pipeline.

03

Compare approaches empirically

The tested LinearSVC pipelines outperformed the tested DistilBERT approach in this project. The reported scores progressed from 0.68695 for the baseline to 0.78003 for the final submission.

04

Document the evaluation setting

The final approach uses transductive TF-IDF: its vocabulary is fitted using training, validation and unlabeled test text. The reported competition score is specific to that evaluation setup.

What I took from it.

  • Model complexity does not automatically translate into better results.
  • Character features can capture useful variation in domain-specific vocabulary.
  • Feature engineering and an explicit evaluation setup are central to interpreting a result.
See for yourself

Source & documentation.

Results & architecture↗Experimental notebook↗Written report↗Implementation walkthrough↗