Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Added: Diet Recommendation System with Machine Learning for Calorie and Dietary Type Predictions #1644

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Recommendation Models/Diet Recommendation System/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2024 RAMESWAR BISOYI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 70 additions & 0 deletions Recommendation Models/Diet Recommendation System/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

# 🥗 Diet Recommendation System

A simple, interactive diet recommendation system that generates personalized meal plans based on user data, including age, weight, height, activity level, and dietary goals. Perfect for users aiming to maintain, lose, or gain weight with tailored calorie and meal suggestions.

## 📜 Project Overview

This tool helps users get personalized meal recommendations based on their unique health metrics and dietary objectives. It calculates BMI, estimates daily caloric needs, and suggests a daily meal plan to help users stay on track with their nutrition goals.

## 📂 Project Structure

- `diet_recommendation_system.ipynb`: The Jupyter Notebook with the interactive code.
- `requirements.txt`: Contains a list of necessary Python libraries for easy setup.

## 🚀 Features

- **BMI Calculation**: Calculates Body Mass Index based on height and weight.
- **Calorie Estimation**: Recommends daily caloric intake based on activity level and dietary goal.
- **Meal Plan**: Provides a basic meal plan with breakfast, lunch, and dinner.

## 🛠️ Installation

To set up the environment, follow these steps:

1. Clone the repository:
```bash
git clone https://github.com/RB137/diet-recommendation-system.git
cd diet-recommendation-system
```

2. Install dependencies:
```bash
pip install -r requirements.txt
```

## 📚 Dependencies

- **pandas** 📊 - For data handling and manipulation.

Install it with:
```bash
pip install pandas
```

## ⚙️ How to Use

1. Open the `diet_recommendation_system.ipynb` file in Jupyter Notebook.
2. Run the cells in sequence.
3. Input your age, weight, height, activity level, and dietary goal when prompted.
4. View your personalized BMI, caloric needs, and meal plan.

## 📝 Example Usage

1. **Age**: `25`
2. **Weight (kg)**: `70`
3. **Height (cm)**: `175`
4. **Activity Level**: `medium`
5. **Goal**: `maintain`

Your meal plan will be displayed based on the input data.

## 💡 Future Improvements

- Adding a more detailed meal database for diverse options.
- Customizing based on dietary restrictions like vegan, gluten-free, etc.
- Integrating API for more dynamic meal recommendations.

## 🤝 Contributing

Contributions are welcome! Please fork the repository and create a pull request with your improvements or suggestions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "e51b3661-7552-4625-a1a2-f8a53cdbda54",
"metadata": {},
"source": [
"# Diet Recommendation System (Basic Version)"
]
},
{
"cell_type": "markdown",
"id": "5918a4e1-c0f0-46b1-8b63-6e25e0816620",
"metadata": {},
"source": [
"# Install necessary libraries"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "bfd7cc27-4a1d-4aac-81fe-eac8f21df9ef",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pandas in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (2.2.2)\n",
"Requirement already satisfied: numpy>=1.26.0 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (1.26.4)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (2.9.0.post0)\n",
"Requirement already satisfied: pytz>=2020.1 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (2024.1)\n",
"Requirement already satisfied: tzdata>=2022.7 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (2023.3)\n",
"Requirement already satisfied: six>=1.5 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n"
]
}
],
"source": [
"!pip install pandas\n",
"\n",
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"id": "495edbf2-870d-403b-a35c-504f505630cd",
"metadata": {},
"source": [
"# Function to get basic diet recommendations"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "b21d9cf3-df1a-4376-90f5-9596a0f31d18",
"metadata": {},
"outputs": [],
"source": [
"def get_diet_recommendation(age, weight, height, activity_level, goal):\n",
" # Basic calculations\n",
" bmi = weight / (height / 100) ** 2\n",
" calories_needed = 0\n",
"\n",
" # Determine calorie needs based on activity level\n",
" if activity_level == 'low':\n",
" calories_needed = 2000 if goal == 'maintain' else (1800 if goal == 'lose' else 2200)\n",
" elif activity_level == 'medium':\n",
" calories_needed = 2200 if goal == 'maintain' else (2000 if goal == 'lose' else 2400)\n",
" elif activity_level == 'high':\n",
" calories_needed = 2500 if goal == 'maintain' else (2300 if goal == 'lose' else 2700)\n",
"\n",
" # Basic diet recommendation\n",
" diet_plan = {\n",
" 'Breakfast': f'Oats with fruits and nuts - {calories_needed * 0.3:.0f} cal',\n",
" 'Lunch': f'Grilled chicken with vegetables - {calories_needed * 0.4:.0f} cal',\n",
" 'Dinner': f'Salad with chickpeas and avocado - {calories_needed * 0.3:.0f} cal'\n",
" }\n",
"\n",
" return {\n",
" 'BMI': round(bmi, 2),\n",
" 'Calories Needed': calories_needed,\n",
" 'Diet Plan': diet_plan\n",
" }\n"
]
},
{
"cell_type": "markdown",
"id": "b1f6fce0-1de5-4f8a-a9ed-609a6ada2da3",
"metadata": {},
"source": [
"# Input user information"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "0c51a088-cf5b-45a6-ad3e-7260f3d7ca4a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Enter age: 20\n",
"Enter weight in kg: 59\n",
"Enter height in cm: 172\n",
"Enter activity level (low, medium, high): medium\n",
"Enter your goal (maintain, lose, gain): gain\n"
]
}
],
"source": [
"age = int(input(\"Enter age: \"))\n",
"weight = float(input(\"Enter weight in kg: \"))\n",
"height = float(input(\"Enter height in cm: \"))\n",
"activity_level = input(\"Enter activity level (low, medium, high): \").lower()\n",
"goal = input(\"Enter your goal (maintain, lose, gain): \").lower()\n",
"\n",
"# Get diet recommendation\n",
"recommendation = get_diet_recommendation(age, weight, height, activity_level, goal)"
]
},
{
"cell_type": "markdown",
"id": "2c119676-3b1d-4929-ba0d-d3da08cf6297",
"metadata": {},
"source": [
"# Display result"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "ebeb1765-a75f-4e81-b882-ea76c1efde5f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Your Diet Recommendation:\n",
"BMI: 19.94\n",
"Calories Needed: 2400\n",
"Meal Plan:\n",
"Breakfast: Oats with fruits and nuts - 720 cal\n",
"Lunch: Grilled chicken with vegetables - 960 cal\n",
"Dinner: Salad with chickpeas and avocado - 720 cal\n"
]
}
],
"source": [
"print(\"\\nYour Diet Recommendation:\")\n",
"print(f\"BMI: {recommendation['BMI']}\")\n",
"print(f\"Calories Needed: {recommendation['Calories Needed']}\")\n",
"print(\"Meal Plan:\")\n",
"for meal, details in recommendation['Diet Plan'].items():\n",
" print(f\"{meal}: {details}\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2208375-2574-4696-9320-601c78fa3ba7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading