Skip to content

System created to help people find alternative foods that have similar nutrition. Compatible with 8k different foods and 75 nutritional attributes

Notifications You must be signed in to change notification settings

conordoyle/FoodRecommendationSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

1 Executive Summary

Our team built a food recommendation system that returns alternatives to inputted foods. We used a large data set from Kaggle that contains around 8.8k foods with about seventy nutritional attributes for each. To create the recommendation system, we used a machine learning method known as clustering to group foods together by similar nutritional values so that when the system is given a food from the dataset, the system outputs foods containing similar nutrition. This is helpful for users who are on diets or who need alternatives to foods they are allergic to, such as peanuts. Our results are promising because the outputted foods make sense and were previously known to be similar to the inputted food. However, since some of the outputs did not make sense and we could not validate the answers further, we cannot endorse this food recommendation system as being fully correct.

2 Introduction

Trying to analyze foods based on nutrition is often very difficult. In addition, some people aren’t able to gain the nutritional benefits of certain foods, because of dietary restrictions. We wanted to find a way to provide alternative foods that contain similar nutrients to foods people cannot eat because of their dietary restrictions. The impacts of this solution can improve the diets and nutrition of many people. In order to accomplish this, we used the machine learning technique of clustering. We clustered the foods in our dataset by similar nutrition, which considers all of the nutritional attributes for each food. Specifically, we grouped foods into 5 distinct clusters where foods in the same cluster have similar nutritional values. Doing so allows us to observe if there is any categorical variance in each cluster. In other words, we are looking to see if different types of foods (vegetables, meats, dairy, carbs) exist in the same cluster. If we observe this, we can recommend alternative foods that are in the same cluster as an inputted food.

3 Data Description

Our dataset was taken from Kaggle - it is a CSV file of 8.8 k common foods and their nutritional values like protein, vitamins, calories, carbs, etc (The size of this dataset is 77 columns x 8789 rows). There are a total of 74 different nutrients and they are all standardized to the serving size of 100 grams. This data was originally gathered using the site https://www.nutritionvalue.org/, which is very credible because its information is sourced from the USDA: https://fdc.nal.usda.gov/download-datasets.html.

4 Food Recommendation System

Given an inputted food to the Food Recommendation System, our functions below search within the cluster of the given food to find the 50 most similar foods from a different food category. To get the 50 closest, we plugged the PCA values of both the inputted food and all the foods in the cluster into a distance formula. We then chose the 50 foods with the smallest distances. This returns the 50 closest foods.

6 Discussion

For the cluster and Plotly graph, we can see that there are different types of foods within each cluster (categorical variance). It is clear that foods can be clustered based off of their nutrition because of the 5 distinct clusters shown.

When we look back at our results for the Food Recommendation System, we are mostly confident with its accuracy. When given an inputted food, the system returns outputs that mostly make sense. Alot of the outputted foods are very viable alternative options in multiple examples that we tested. However, the system is not without its flaws. Some of the outputs simply do not make sense and it is our belief that they should not be there. In addition, although this system recommends foods from different categories, that doesn't mean that all of the outputted foods do not contain the inputted food. This is a flaw for people with allergies, for example, because even though a recommended alternative might be different, it still might contain the inputted food that the user is allergic to. In the example below, peanuts are inputted to stimulate a user that has a peanut allergy. Most of the outputs make sense and can be used as very viable alternatives to peanuts. Consider walnuts, which is the very first food returned. However, some of the foods contain peanuts, such as peanut butter and mixed nuts. Obviously, these would not be viable options because they contain peanuts, which the user is allergic to.

About

System created to help people find alternative foods that have similar nutrition. Compatible with 8k different foods and 75 nutritional attributes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages