The goal of this project is to create a model that can predict what food group a specific food item belongs to based on its nutritional information. A
There are four main folders in this repository:
Folder | Description |
---|---|
archive |
Contains old files that are no longer used. |
data |
Contains the data files used in our project. |
report |
Contains the LaTeX source code for our project_group40.pdf report. |
src |
Contains the main source code for our project. |
This project uses Python 3.11.3. See Additional requirements for instructions on setting up the correct Python environment and installing dependencies.
-
Run the
preprocessing.ipynb
notebook to preprocess the data.This will create a
data/generated
folder containingpreprocessed-data-classification-first.csv
,preprocessed-data-classification-second.csv
andpreprocessed-data-classification-third.csv
, which are the preprocessed data files used in our project. -
Run the
knn.ipynb
notebook to train and evaluate the$k$ -nearest neighbour model.This will generate a few plots and saved to
report/figs
.
We will be using the current latest version of Python (v3.11.3 as of 24/04/2023). To install and use the correct version of Python in a virtual environment, follow the steps below on macOS.
-
Install
pyenv
, a Python version manager. See pyenv's installation guide.brew install pyenv
-
Install virtualenv, a tool to create isolated Python environments:
pip install virtualenv
-
Install Python 3.11.3 using
pyenv
:pyenv install 3.11.3
-
Create a virtual environment using Python 3.11.3:
virtualenv -p $(pyenv which python3.11.3) venv
-
Activate the virtual environment:
source venv/bin/activate
Check that the Python version is correct:
python --version
You should see
Python 3.11.3
. -
Now that you have the correct Python version, install the dependencies into the virtual environment:
pip install -r requirements.txt
-
(Optional) To deactivate the virtual environment, run:
deactivate
- Victoria Lyngaae
- Mason Sebek
- David Sha
- William Spongberg