Skip to content

Repository files navigation

Natural Language Project - Find the Chef

Classify the creator chef (chef_id) of a recipe using its metadata and text fields. This repository contains a Python 3 pipeline that trains and evaluates multiple models, then predicts labels for the provided unlabeled test set.

Project summary

  • Task: map each recipe to one of 6 chefs using recipe name, description, steps, tags, ingredients, and simple numeric features.
  • Data: train.csv (labeled) and test-no-labels.csv (unlabeled), semicolon-delimited.
  • Evaluation: accuracy (per the project description in Project-2025-Description.pdf).
  • Deliverables: model outputs (results.txt) and a short report (report/Project-2025-Report.pdf).

Repository layout

  • main_proj.py: end-to-end training, evaluation, and prediction script.
  • data/datasets/train.csv: labeled training data.
  • data/datasets/test-no-labels.csv: unlabeled evaluation data.
  • data/results/: confusion matrices and a sample test_report.txt.
  • preds_logreg_count.txt, preds_svc_count.txt: example prediction outputs.
  • Project-2025-Description.pdf: original project brief.
  • report/Project-2025-Report.pdf: final report.

Features and modeling

The pipeline builds features from:

  • tags and ingredients: parsed as list-like strings and one-hot encoded.
  • recipe_name, description, steps: concatenated and vectorized with TF-IDF or Count n-grams.
  • n_ingredients and elapsed_days (derived from data).

Models evaluated:

  • Logistic Regression
  • Multinomial Naive Bayes
  • LinearSVC
  • Gaussian Naive Bayes

Cross-validation is run with stratified folds, then a held-out test split is reported with classification metrics and confusion matrices.

Setup

Create a Python 3 environment and install dependencies:

python3 -m venv .venv
source .venv/bin/activate
pip install pandas numpy scikit-learn matplotlib

Running

The script expects train.csv and test-no-labels.csv in the current working directory. You can either copy the datasets into the repo root, or adjust paths in main_proj.py.

Option A: copy datasets and run from the repo root:

cp data/datasets/train.csv .
cp data/datasets/test-no-labels.csv .
python3 main_proj.py

Option B: update the CSV paths in main_proj.py to point to data/datasets/.

Outputs

Running main_proj.py produces:

  • test_report.txt: cross-validation scores and classification reports.
  • *_confusion_matrix_*.png: confusion matrices for each model.
  • preds_logreg_count.txt, preds_svc_count.txt: predictions for the unlabeled test set.

For submission, rename the chosen predictions file to results.txt so the line order matches test-no-labels.csv.

Notes

  • The date field is converted to elapsed_days from a fixed origin (1999-01-01).
  • Missing numeric values are imputed from the training median or set to zero.
  • The best-performing models in this implementation use Count Vectorizer features.

About

Classify the creator chef (chef_id) of a recipe using its metadata and text fields.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages