Automated Diet and Exercise Suggestion based on Obesity Classification

. Obesity is a problem that affects the general health and wellness of many people around the world. The paper seeks to provide an automated individualised dietary and exercise suggestions based on an individual's obesity class. The system classifies the user's level of obesity using Artificial Neural Networks (ANN), Support Vector Machines (SVM), and random forest machine learning algorithms. To provide appropriate food and activity procedures in accordance with the classification of obesity, we use machine learning techniques like decision trees and recommendation algorithms.


Introduction
Obesity is a medical disorder characterised by excessive fat accumulation to the point where it negatively impacts an individual's health.Body Mass Index (BMI) is a typical definition, which is computed by dividing a person's weight in kilogrammes by their height in metres squared.Obesity is defined as a BMI of 30 or more, whereas overweight is defined as a BMI of 25 to 29.9.Obesity is linked to a variety of health issues, including type 2 diabetes, heart disease, stroke, high blood pressure, and certain types of cancer, esteem, despair, and social isolation.Obesity treatment usually includes making lifestyle changes, such as increasing physical activity and eating a nutritious diet.The long-lasting solution for fit body is to maintain proper diet and follow an exercise routine.So a machine learning algorithm which recommends automated diet and exercise based on each individuals need and body type to transform the user and help maintaining a fit and healthy life is vital and helps all its users.In this paper, we are using a decision tree classification algorithm.

Working of decision tree algorithm
A machine learning approach called decision tree classification is utilised for both regression and classification tasks.It is a supervised learning method that constructs a treelike model of decisions and their potential outcomes.The tree is built by iteratively separating the data on different attributes, with the purpose of maximising class separation or minimising impurity within each class.

Methodology
Our system is a web-based application that provides personalized diet and exercise recommendations to users.The user interacts with the system through a web interface, where they input information about their diet and exercise preferences, goals, and other relevant data.It receives the user's inputs and forwards them to the appropriate components for further processing.
This step includes tasks like data normalization, handling missing values, and feature selection.The preprocessed data is then used to build a classification model.The model is trained on existing data and algorithms to predict appropriate diet and exercise recommendations based on the user's inputs.The built model is tested and evaluated using validation techniques to ensure its accuracy and reliability.Based on the classification results, personalized diet and exercise recommendations are generated.Once the recommendations are generated, the system generates a response that contains the personalized diet and exercise recommendations.This response is sent back to the web server.Finally, the web server presents the diet and exercise recommendations to the user through the web interface.

Overview
Existing approaches in obesity classification typically involve assessing an individual's body composition, primarily using body mass index (BMI), and considering additional factors such as waist circumference, waist-to-hip ratio, body composition analysis, obesityrelated comorbidities and overall health status.Table 1 is a summary of common obesity classification existing approaches.
Authors [14] explored the distinct ML applications in predicting heart attacks using patient health records.It compares Random Forest and CNN methods, and findings showed that Random Forest's better performance in terms of accuracy.Authors [15] highlighted the significance of ML in prediction, pattern recognition and error reduction across diverse fields, emphasizing the impact of AI in broad domain.
Authors [16] suggested data mining techniques to predict disease-prevalence based on symptoms in healthcare data.The appropriate prediction helps healthcare organizations avoid drug shortages and further ensures timely treatment of patients.
Authors [17] discussed the role of Intelligent Decision Support Systems (IDSS) in Healthcare Monitoring, especially for heart disease.Results claimed that IDSS enhances decision-making functionalities in uncertain healthcare scenarios, there by significantly improving the monitoring and remedial activities.
Authors [18] employed Independent Component Analysis (ICA) and HDFS-based algorithm to diminish the dimensionality in huge patient datasets, followed by removing irrelevant data and reducing storage and computation time, with superior accuracy compared to Principal Component Analysis (PCA).3 Proposed method

Problem statement
It is crucial to highlight that healthy eating habits are beneficial to both physical and mental health.A diet rich in fruits, vegetables, whole grains, and lean meats has been demonstrated in studies to help reduce the risk of depression and anxiety.Exercise can help lower your risk of chronic diseases like heart disease and diabetes, as well as enhance your mood and cognitive performance.
Ultimately, the key to adopting a healthy lifestyle is to make small, sustainable changes over time.By gradually incorporating healthy habits into your routine, such as eating more fruits and vegetables, and taking short walks throughout the day, you can make significant improvements in your health and wellbeing over time.

Objectives of paper
• To take control of their health and improve overall well-being.
• To classify obesity and provide automated diet recommendations.
• To empower individuals to take control of their health and improve overall well-being.production environment, such as a web application or mobile app.It involves selecting appropriate deployment tools, testing and debugging the application, and ensuring that the solution is scalable and reliable.8. Maintenance Module: This module is responsible for maintaining and updating the deployed solution over time.It involves monitoring the performance of the application, identifying and fixing bugs, and updating the solution to incorporate new data or features.The system described in the architecture diagram is a web-based application for providing personalized diet and exercise recommendations.Users interact with the system through a web interface, providing inputs regarding their diet and exercise preferences, goals, and other relevant information.The inputs are received by a web server, which forwards them to the appropriate components for further processing.The inputs undergo data preprocessing to clean and transform the data into a suitable format.A classification model is then built using the preprocessed data, trained on existing data and algorithms to predict appropriate recommendations.The model is tested to ensure its accuracy and reliability.The Obesity Dataset -raw-and-data-synthetic is a large-scale dataset used to work on papers and studies related to obesity.This dataset is related to obesity, and it contains both raw and synthetic data.It likely includes information about various factors that contribute to obesity, such as diet, exercise, lifestyle, and medical history.

Decision tree classifier
1. Importing Required Libraries: It is assumed that the necessary libraries, such as Decision Tree Classifier from sklearn.tree, pd from pandas, and accuracy_score from sklearn.metrics, have been imported earlier in the code.

Initializing and Training the Classifier: The code creates an instance of the Decision
Tree Classifier class and assigns it to the variable tree_clf.The classifier is then trained on the training data (dfx_train and dfy_train) using the fit method.3. Printing Classifier Configuration: The code prints information about the trained decision tree classifier.This output provides details such as the hyperparameters and default configuration of the classifier.4. Making Predictions on Test Data: The code uses the trained classifier (tree_clf) to make predictions on the test data (dfx_test).The predicted labels are stored in a DataFrame called Test_predict. 5. Calculating Accuracy: The code calculates the accuracy of the classifier's predictions by comparing them to the true labels (dfy_test) using the accuracy_score function from the sklearn.metricsmodule.The accuracy score is printed as "Accuracy: <accuracy_value>".Here, Using DecisionTreeClassifier we obtained an accuracy of 93% for the given classification model.Finally, after the model is trained on the dataset and obtained good accuracy, we take inputs from the users regarding their eating habits, personal lifestyle habits and some basic information such as age, weight and height.After filling all the required data fields the model takes the inputs and runs on the trained model and classifies the instance into one of the existing classes.After all the fields are filled your personalised diet and exercise plan is ready for you in an instance as follows.

Exercise plan
Here we have different types of exercises and there examples.

Conclusion and future enhancements
The use of machine learning algorithms in diet and exercise recommendation systems is a successful strategy for predicting weight loss in obese people.Automated diet and exercise plan will improve the individual's health.The food and exercise data were most accurately represented by the Decision Tree algorithm, which can be used by medical professionals to effectively counsel and prescribe for obese patients.Integration with Fitness Trackers -We can integrate the system with popular fitness trackers or wearable devices to collect realtime data such as heart rate, steps taken, and calories burned.Goal Tracking and Progress Visualization -Provide users with tools to set goals, track their progress, and visualize their achievements.This can include visual charts, graphs, or dashboards that display weight loss/gain, calorie intake, exercise duration, and other relevant metrics.Mobile Application -Develop a dedicated mobile application for easy access to the system's features on smartphones and tablets.This will enhance user convenience and enable them to receive automated recommendations, track progress, and access resources on-the-go.

Fig. 1 .
Fig. 1.Connectivity diagram of the proposed work.1.Data Collection Module: This module is related to collecting data on the individual's personal information, such as age, sex, weight, height, and body composition measurements, as well as their dietary preferences and exercise habits.2. Data Pre-processing Module: This module is responsible for cleaning and transforming the collected data into a format suitable for analysis.It involves tasks such as data normalization, missing value imputation, and feature selection.3. Obesity Classification Module: This module is responsible for classifying the individual's level of obesity based on their personal information and body composition

Fig. 3 .
Fig. 3. Dataset.The class variable NO obesity was then constructed with the values of Insufficient Weight, Normal Weight, Overweight Level I, Overweight Level II, Obesity Type I, Obesity Type II, and Obesity Type III.This was done after all the data had been labelled.

Fig. 4 .
Fig. 4. Relation between attributes.The above fig shows the distribution of weight, age and height.It also depicts how weight and age are correlated and how weight and height are correlated.Now the above data frame is modified into a newer data frame which has less categorical values and more numerical values.We convert the columns by using OneHotEncoder and assign different numerical values based on the values in the dataset.

Table 1 .
Summary of few existing approaches.
1. Importing Required Libraries: It is assumed that the necessary libraries, such as matplotlib.pyplot(usuallyimportedasplt) and pd from pandas, have been imported earlier in the code.Setting Figure Size and Subplot Configuration: ).plot.bar() to generate a bar chart displaying the count of each original test label.The default colors are used for the bars.The axes labels and title of the subplot are set using plt.xlabel,plt.ylabel,andplt.title.3.Setting Up the Second Subplot: The code uses plt.subplot(132) to activate the second subplot.4.Calculating and Printing Value Counts: The code calculates the value counts of the predicted labels (Test_predict) and the original test labels (dfy_test) and assigns them to variables Val1 and Val2, respectively.5.Printing Prediction Results:The code prints the value counts of the predicted labels with the header "Prediction Results" using print(Val1).6.Printing Original Test Data: The code prints the value counts of the original test labels with the header "Original Test Data" using print(Val2).To summarize, this code snippet performs one-hot encoding using the OneHotEncoder from the sklearn.preprocessingmodule.It fits the encoder on the df_bool DataFrame, transforms the data into a one-hot encoded format, converts it to a NumPy array, stores it in df_xOHE, and then displays the shape and contents of df_xOHE.