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.
- Task: map each recipe to one of 6 chefs using recipe name, description, steps, tags, ingredients, and simple numeric features.
- Data:
train.csv(labeled) andtest-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).
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 sampletest_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.
The pipeline builds features from:
tagsandingredients: parsed as list-like strings and one-hot encoded.recipe_name,description,steps: concatenated and vectorized with TF-IDF or Count n-grams.n_ingredientsandelapsed_days(derived fromdata).
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.
Create a Python 3 environment and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install pandas numpy scikit-learn matplotlibThe 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.pyOption B: update the CSV paths in main_proj.py to point to data/datasets/.
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.
- The date field is converted to
elapsed_daysfrom 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.