Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: hamzahussainshah
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 45.9 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 9 months ago · Last pushed 9 months ago
Metadata Files
Readme License Code of conduct Citation

README.md

DOI

Diet Recommendation System

A diet recommendation web application using content-based approach with Scikit-Learn, FastAPI and Streamlit.

Diet-Recommendation-System

:bookmark_tabs:Table of contents

:scroll: General info

Motivation

People from all around the world are getting more concerned in their health and way of life in today's modern environment. However, avoiding junk food and exercising alone are insufficient; we also need to eat a balanced diet. We can live a healthy life with a balanced diet based on our height, weight, and age. Your diet can help you achieve and maintain a healthy weight, lower your chance of developing chronic diseases (including cancer and heart disease), and improve your general health when combined with physical activity. Nevertheless, there is a little SOTA project on food/diet recommendation system. Therefore I got the idea to build a content-based recommendation system for this purpose using machine learning.

What is a food recommendation engine?

A food recommendation engine using a content-based approach is an important tool for promoting healthy eating habits. This type of engine uses information about the nutritional content and ingredients of foods to make personalized recommendations to users. One of the key advantages of a content-based approach is that it takes into account an individual's dietary restrictions and preferences, such as allergies or food preferences. By providing users with tailored recommendations, a content-based food recommendation engine can help them make better choices about what to eat and improve their overall health. Additionally, by recommending a variety of healthy foods, it can also help users to discover new and nutritious options, expand their dietary horizons and overcome food boredom. All these can lead to a better and well-rounded diet, which can have a positive impact on long-term health outcomes.

What is a content-based recommendation engine?

A content-based recommendation engine is a type of recommendation system that uses the characteristics or content of an item to recommend similar items to users. It works by analyzing the content of items, such as text, images, or audio, and identifying patterns or features that are associated with certain items. These patterns or features are then used to compare items and recommend similar ones to users.

Why content-based approach?

  • No data from other users is required to start making recommendations.
  • Recommendations are highly relevant to the user.
  • Recommendations are transparent to the user.
  • You avoid the “cold start” problem.
  • Content-based filtering systems are generally easier to create.

Challenges of content-based approach

  • There’s a lack of novelty and diversity.
  • Scalability is a challenge.
  • Attributes may be incorrect or inconsistent.

:computer:Development

Model developement

The recommendation engine is built using Nearest Neighbors alogrithm which is an unsupervised learner for implementing neighbor searches. It acts as a uniform interface to three different nearest neighbors algorithms: BallTree, KDTree, and a brute-force algorithm based on routines in sklearn.metrics.pairwise. For our case, we used the brute-force algorithm using cosine similarity due to its fast computation for small datasets.

$$cos(theta) = (A * B) / (||A|| * ||B||)$$

Dataset

I used Food.com kaggle dataset Data with over 500,000 recipes and 1,400,000 reviews from Food.com. Visit this kaggle link for more details.

Backend Developement

The application is built using the FastAPI framework, which allows for the creation of fast and efficient web APIs. When a user makes a request to the API (user data,nutrition data...) the model is used to generate a list of recommended food similar/suitable to his request (data) which are then returned to the user via the API.

Frontend Developement

The application's front-end is made with Streamlit. Streamlit is an open source app framework in Python language. It helps to create web apps for data science and machine learning in a short time. It is compatible with major Python libraries such as scikit-learn, Keras, PyTorch, SymPy(latex), NumPy, pandas, Matplotlib etc. For our case the front-end is composed of three web pages. The main page is Hello.py which is a welcoming page used to introduce you to my project. The side bar on the left allows the user to navigate too the automatic diet recommendation page and the custom food recommendation page. In the diet recommendation page the user can fill information about his age,weight,height.. and gets a diet recommendation based on his information. Besides, the custom food recommendation allows the user to specify more his food preferency using nutritional values.

Deployement using Docker

Why Docker?

By using Docker, you can ensure that the environment in which the application is exactly the same as the environment in which it was built, which can help prevent unexpected issues and improve model performance. Additionally, Docker allows for easy scaling and management of the deployment, making it a great choice for larger machine learning projects.

Docker-Compose

My project is composed of different services (frontend,API). Therefore, our application should run on multiple containers. With the help of Docker-compose we can share our application using the yaml file that define the services that runs together.

Project Architecture

:rocket: Technologies

The project is created with: * Python: 3.10.8 * fastapi 0.88.0 * uvicorn 0.20.0 * scikit-learn 1.1.3 * Pandas: 1.5.1 * Streamlit: 1.16.0 * streamlit-echarts 1.24.1 * Numpy: 1.21.5 * beautifulsoup4 4.11.1

:whale: Setup

Run it locally

Clone the repo

$ git clone https://github.com/zakaria-narjis/Diet-Recommendation-System

docker-compose

In the project root run: $ docker-compose up -d --build Then open http://localhost:8501 and enjoy :smiley:.

PS: You should have docker and docker-compose already installed

Use the hosted version on Streamlit Cloud

https://diet-recommendation-system.streamlit.app/

Citation

@software{narjis_2024_12507829, author = {Narjis, Zakaria}, title = {Diet recommendation system}, month = jun, year = 2024, publisher = {Zenodo}, version = {v1.0.1}, doi = {10.5281/zenodo.12507829}, url = {https://doi.org/10.5281/zenodo.12507829} }

Owner

  • Name: Hamza Hussain Shah
  • Login: hamzahussainshah
  • Kind: user

I am a Software Engineer. I have completed my BSc in Software Engineering from Comsats University. I am a Flutter developer passionate about creating mobile app

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Diet recommendation system
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Zakaria
    family-names: Narjis
    email: zakaria.narjis.97@gmail.com
    orcid: 'https://orcid.org/0009-0007-7033-4419'
identifiers:
  - type: doi
    value: 10.5281/zenodo.12507164
    description: >-
      https://github.com/zakaria-narjis/Diet-Recommendation-System/releases/tag/v1.0.0
repository-code: >-
  https://github.com/zakaria-narjis/Diet-Recommendation-System
url: 'https://diet-recommendation-system.streamlit.app/'
abstract: >-
  People from all around the world are getting more
  concerned in their health and way of life in today's
  modern environment. However, avoiding junk food and
  exercising alone are insufficient; we also need to eat a
  balanced diet. We can live a healthy life with a balanced
  diet based on our height, weight, and age. Your diet can
  help you achieve and maintain a healthy weight, lower your
  chance of developing chronic diseases (including cancer
  and heart disease), and improve your general health when
  combined with physical activity. Nevertheless, there is a
  little SOTA project on food/diet recommendation system.
  Therefore we propose a content-based recommendation system
  for this purpose using machine learning.
keywords:
  - Machine learning
  - Artificial Intelligence
  - Recommendation systems
  - K-Nearest Neighbors
license: Apache-2.0
commit: 5220900440aaf906d5bb6efe4fa0ac6ec3ee224b
version: 1.0.0
date-released: '2023-01-12'

GitHub Events

Total
  • Push event: 1
  • Create event: 1
Last Year
  • Push event: 1
  • Create event: 1

Dependencies

Dockerfile docker
  • python 3.10.8 build
docker-compose.yml docker
  • backend latest
  • frontend latest
requirements.txt pypi
  • fastapi ==0.88.0
  • numpy ==1.24.1
  • pandas ==1.5.1
  • pydantic ==1.10.4
  • scikit-learn ==1.1.3
  • uvicorn ==0.20.0