|Annalie Kruseman b5382b7f04 Convert README.rst to .md||1 month ago|
|.dvc||1 month ago|
|figures||1 month ago|
|recipe_recommendations||1 month ago|
|tests||3 months ago|
|.DS_Store||1 month ago|
|.gitignore||2 months ago|
|.python-version||3 months ago|
|README.md||1 month ago|
|data.dvc||2 months ago|
|example.png||3 months ago|
|poetry.lock||2 months ago|
|pyproject.toml||2 months ago|
|DVC Managed File|
|Git Managed File|
|DVC Managed File|
|Git Managed File|
Often recipe websites contain a filter to look for recipes. Sometimes when you look for a recipe you don’t necessarily know what filter you want to apply exactly. Do you want to filter on recipes with zucchini or carrots? Maybe you don’t mind what kind of vegetable is used when the taste of the dishes are sort of similar. The goal of this recommendation system is to find recipes that are considered similar in taste and composition. And, to challenge your comfortzone with new recipes. In order to do that we use the ingredients of each recipe as the features and calculate how similar to another recipe each recipe is. To build the features we use the bag of words technique. For the similarity metric we use the cosine similarity. The advantage of using a cosine similarity metric is to outweigh the fact that some recipes contain very few ingredients and others contain many. By converting recipes to vectors we only consider the angel between two vectors and not the lenght. Hence, the cosine similarity works well with sparse matrices. The foundation of this recommendation system is a network graph. A network graph will provide a representation of how connected, or similar, recipes are. The resulting network consists only of recipes that exceed the threshold of a similarity score of 0.5. In this example the relations between recipes are explored. However, the concept described here can be applied to many other type of relations between entities or actors.
The result of this recommendation system is presented with the Streamlit application and contains an interactive network made with Plotly and Networkx.
Make sure Streamlit is installed and a python version between 3.6 and 3.8 is running. The python version of this application python 3.8.6. For all prerequisites see the dependencies in the file pyproject.toml.
The data for this application is stored in a personal AWS S3 bucket and retreived with the data version control package DVC. If you would like to replicate this application clone this repository and download the raw dataset, see link at the bottom of this page. .
When downloading the data with DVC it is assumed that the data is stored elsewhere and that DVC is connected. Next, use the following line of code in the same directory in your terminal to fetch the data:
To run the streamlit application and view the recommendation system run:
streamlit run recipes_recommendatons.py
Alternative to running the streamlit application you may run the raw python code that outputs the recommendation for a particular recipe as an interactive network graph in your browser. Choose a threshold for the similarity metric as the first argument and the recipe as the second argument. To replicate this code run:
python raw_code.py .5 41995
The recommendation system created here is an example of exploring relations between between entities. The data used here consists of text, but the concept can be used for many other applications. Think of a network of people and their behaviors, or a network of connected roads.
Feel free to contact me for any questions on email@example.com
Dataset downloaded from Kaggles ‘What’s Cooking’