Intelligent Automation & Soft Computing

Intelligent Nutrition Diet Recommender System for Diabetic’s Patients

Nadia Tabassum1, Abdul Rehman2, Muhammad Hamid3,*, Muhammad Saleem4, Saadia Malik5 and Tahir Alyas2

1Department of Computer Science, Virtual University of Pakistan, Lahore, 54000, Pakistan
2Department of Computer Science, Lahore Garrison University, Lahore, 54000, Pakistan
3Department of Statistics and Computer Science, University of Veterinary and Animal Sciences, Lahore, 54000, Pakistan
4Department of Industrial Engineering, Faculty of Engineering, Rabigh, King Abdulaziz University, Jeddah, 21589, Saudi Arabia
5Department of Information Systems, Faculty of Computing and Information Technology – Rabigh, King Abdulaziz University, Jeddah, 21589, Saudi Arabia
*Corresponding Author: Muhammad Hamid, Email: muhammad.hamid@uvas.edu.pk
Received: 24 March 2021; Accepted: 02 May 2021

Abstract: Diabetes is one of the ever-increasing menace crippling millions of people worldwide. It is an independent risk factor for many cardiovascular diseases including medium and small vessels and results in heart attack, stroke, kidney failure, blindness, and lower-limb amputations. According to a World Health Organization (WHO) report estimated 1.6 million deaths were the direct result of diabetes. Nutrition plays a vital role in diabetes management alongside physical activity, drugs, and insulin. Weight management can help to avert or delay at pre-diabetic stages. This research work explains the features of the Nutrition Diet Expert System (NDES), which will preferably be used by the health care professionals (HCPs) for calculating per day calorie requirements of diabetic patients and recommend the best diet plan to control diabetes. The primary objective of this proposed model for diet plan is to help individuals attain healthy body weight and optimum check on diabetes by gaining control over blood pressure and lipid count. The ultimate focus of this research result is prevention of diabetes related complications using nutrition diet expert system. In this paper, proposed recommender system has come in handy in figuring out the diet plan by determining the individual dietary requirements at the level of micro and macro nutrients for expert system using fuzzy logic. The results are very promising indicating testing and assessment of the expert system worked well for the individual diet plan.

Keywords: Diet expert; diet plan; diabetic; diet recommender; fuzzy inference

1  Introduction

Management of Diabetes Mellitus requires lifestyle changes and careful meal planning on day to day basis. Adopting a balanced diet plan controls diabetes and in turn reduces the risks of cardiovascular diseases, increasing the prospects of healthy life free of morbidity and delaying mortality. By intelligent meal planning these goals can be achieved. There is a whole plethora of websites and smartphone applications available for users to plan their meals in view of their personal health status [1]. However, many apps and websites focusing singularly on calorie and sugar levels fail to take into account other important factors that have crucial values for an individual’s health like personal constraints, socio-economic status, tradition, and culture. Because of sociocultural differences, no single approach fits all. Furthermore, diabetic patients have predefined limitations for food selection that can fulfill requirements [2]. Our proposed system is effective for meal planning and can be tailored individually. It recommends multiple diet choices including different vegetables, grain, fruit, and meat considering the specific medical requirements of the patients. According to WHO about 422 million people have diabetes worldwide [3] and one of the leading causes of death worldwide amounts to 1.6 million each year [4]. Systematic analysis of 195 countries for the global burden of disease estimates that 11 million deaths are associated with poor diet and dietary risk factors are contributing to a range of chronic diseases among people around the world including diabetes and cardiovascular disease. Low amounts of foods containing whole grains, fruit, nuts, and seeds and high levels of trans-fats, sugary drinks, and high levels of red and processed meats are the contributory factors. Considering different requirements and constraints, this study proposes a system to make decisions based on different conditions. This research work mainly focuses on the development of a reliable Nutrition Diet Expert System (NDES) based on nutritional recommendations for diabetes patients that will be useful specifically for HCPs and will enable them to monitor the patients’ health in hospitals and at home [5]. Health monitoring systems are one of the major advancements in the information technology (IT) field with the market of wearable devices worldwide producing revenue of around $26 B which is expected to increase to $34 B in 2021 [6].

To achieve these goals, this research applies machine learning logic to design a healthy and nutritious food chart for diabetic patients based on factors including age, gender, height, weight, type and intensity of physical activity. In countries like Pakistan with low literacy rates, public education on diet and a healthy lifestyle is very challenging, especially for people of rural backgrounds and low socioeconomic strata. There is a heightened need for such programs and Fuzzy logic can be a promising tool for HCPs to guide diabetic patients to maintain their healthy profile through compliance with proposed dietary options [7].

2  Related Works

Selection of food intake affects people with Diabetes Mellitus. Dietary adjustment and insulin can modulate blood sugar levels. This research paper proposes an intelligent system through fuzzy inference that recommends food based on the severity of the disease and on personal lifestyle and contains recommendations including the diet plan mechanism and real-time processing mechanisms. A platform has been developed for experiments to check personal health and performance. The results showed the effort of registered dietician and also show proposed method work effectively [8].

Health management through proper diet planning is a key to successful operation of health systems . There are many online apps available for personal food planning according to sugar levels, type, and degree of severity of diabetes and associated complications. These apps take into account taste preference and cost of food. However, there is room for improvement. We propose and develop a new system that takes decisions based on multiple criteria for food recommendation including natural ingredient selection and cultural differences amongst others [9].

Multi agent web based model is working as a clinical-based nutrition system and work as prototype of virtual clinical system which can examine and recommend multiple kinds of nutrition that are essential for the human body [10].

This paper describes [11] the problem of healthy nutrition based on individual human diet analysis using its infrastructure. The program for a balanced eating method for diet correction was created as a mobile application. For the optimization of person balanced eating, analysis and correction of technological applications for desktop and mobile computers designed for a healthy diet, strategic framework base of information technology systems, and a general system for decision making are prepared [12].

A personalized diet system provides food suggestions to individuals based on the genetic test. A personalized diet is used to avoid nutrigenomics emergencies and is used for food recommendations. However, the main issue of recommending the food is a connection between genetics, personalized food, and data scalability for the applied system. In this paper, a personalized nutrition system is introduced to provide personalized recommendation applications for consumers. Categorization of products can be achieved by deep learning and applied neural networks [13].

An expert and intelligent diagnosis-system is introduced using artificial neural networks that ensure the veracity of the reasoning system. The sample of six crops used in the system for diagnosis and recommendation. MCS_51C language is used to confirm the confidences of symptoms using a computer chip. Moreover, the computer chip and expert system validate the diagnosis error of less than 10%. Experiment results store in knowledge memory for future diagnosis [14].

Health is a very important aspect of a family. As for children, proper diet helps them not only lead a good life but also enables them to grow and perform to their full. So, children require comprehensive help with healthy food and this target is the mainstay of the health of the whole family. Author proposed and designed a system for children of different age stages, which provides the user with a nutrition expert system. Nutrition expert system that provides healthy food plan for children of different age groups according to a certain situation is based solely on children’s ages. A web-based application is developed to demonstrate how the functionality of the proposed system can be achieved for children nutrition expert web-based system [15].

3  Fuzzy Logic and Membership Function

It is a huge challenge to suggest someone a food plan list according to the body mass index (BMI) and daily required calories because the calculated relation and link between these variables values is very complex and there is no proper mathematical equation that provides the exact required output for this recommender system.

By keeping the focus of the problem statement, there is a need to design the intelligent recommender system to build up one or more fuzzy membership functions. For example, a person can be of 20 to 22 years that can be considered an adult or non-adult can have a membership function in a fuzzy logic system based on 0.6 degrees because the value of membership function lies between 0 and 1 for all points to manage multiple curves. So, while at the time of 0.6 degrees a person may have another membership degree for another age group. According to these requirements, there are 2 different fuzzy membership functions (MF).

•   Trapezoidal MF

•   Triangular MF

In the function of fuzzification, age of the patient is divided into membership functions and these are 2 member functions as shown in Tab. 1 of age group detail.


Similarly, patient BMI is divided into four different groups: underweight, overweight, normal, and obese. Tab. 2 shows the detail of BMI Interpretation groups.


3.1 Proposed Model Designing

The proposed system will recommend diet of different individuals through the fuzzification phase. Later high and low costs will be added in the form of input to manage the final output of the system. The first part of the proposed system is fuzzification that will recommend a nutrient diet in increasing as well in decrement way. Age and body index will act as a fuzzy input variable and it will decide which nutrients of the diet need to be taken more or which need to be taken less. A sample of 20 nutrients that have a connection with the heath of a person, include fiber, zinc, iron, calcium, vitamin A-C, fat, protein, and carbohydrates for health indication. The final step of fuzzification are used to recommend proper food based on cost and nutrition requirements. The income of the person living in the rural area is associated with nutritional deficiency and both are taken as input in the fuzzification process [16,17].

3.2 Body Mass Index and Analysis for Recommendation of Nutrients

BMI is a measurement of an individual’s body fat based on height and weight. It is depicted in Fig. 1. Since our system is for diabetes patients, hence the process will start with finding the BMI of the patient and then look for the type of diabetes the patient has as it is of 2 types—type 1 or type 2. After finding BMI, we calculate the required calories per day. Our system already has some groups based on the physical characteristics - normal, underweight, and overweight. We measure the patient’s weight as per a preset standard which dictates that we take 60–70 normal, above 70 overweight, and below 60 is underweight [18]. Group formation is carried out depending upon body weights and how much proteins and carbohydrates are required by a patient of a specific group. Our system has five food variations, comprising vegetables, fruits, dairy, meat, and fiber. Our system will recommend the diet with different variations according to the type of diabetes and calorie requirement, which is cost and divided into Low and high scale, based on all food diet variations as shown in Fig. 1. The BMI formula is:

BMI=(Weightinkilograms)/(Heightinmeterssquared) (1)

A = age in years, H = height in meters, W = weight in kg

Let’s consider a patient who is a 25-year-old female and moderately active. She is 190 cm tall and weighs

75 kg. So, calculation of BMI

Height = 190 cm (H) = 1.9 m

Weight = 75 kg (W)

Gender = Female (G)

Put values in Eq. (1)

BMI = 75 / (1.9)2

BMI = 75 / 3.61

BMI = 20.8 kg/m2 (Normal Value)


Figure 1: BMI and analysis for recommendation of nutrients hierarchy chart

For example, if a user is sedentary or age is 21–25 and he is a male, he should take 2,400 calories. If he is moderate will take 2,800 and if he is very active will take 3,000. Likewise, if the person is a female and sedentary or age is 21–25 she should take 2,000 calories, if she is moderate type physically she will take 2,200 calories and if she is very active will take 2,400 calories. Tab. 3 shows nutritional requirements destined according to age and gender-wise.


Similarly, suggestions for carbohydrate, protein, or fat are depicted in Tab. 4. This delineates how many dietary requirements of micronutrient as well macronutrients are prescribed for different age groups and type of gender is mentioned in the table below in which macronutrients have been categorized in three different types like carbohydrates proteins and fats.


A regular BMI is relatively proportional to an average basal metabolic rate (BMR), which we just managed previously. So, the diabetic nutrition suggested normal BMI must be deemed average relative to the calorie intake in the above procedure. The combination of Age and BMI variation are in above average, average, and below-average are estimated calories and micronutrients in above Tab. 5. The recommended dietary requirements of micronutrient as well macronutrients prescribed for different age groups are mentioned in the table below.

A = Above Average range of calories

B = Average range of calories

C = Below Average range of calories


The measured BMI is based on normal, underweight, and overweight categories. The membership curve sometimes overlapped between multiple cases. For example, the body mass index of a person having a value of 26 can manage under the normal and overweight category. So, based on calculation we have decided to use a category that has the greater degree of the membership function.

Consider X1 be the membership degree for BMI:

X1=max((2523.44)/(2520.77),(2321.44)/(2319.24)) (2)

X1=(1.56/4.23),(1.56/3.76) X1=0.369,0.415(Normalcategory)

X2 as for the degree of membership for age value:

X2=max(2919)/(3719) (3)


Since the value of membership, a function is divided into three categories as normal, underweight, and overweight so following calculation of FM that have the maximum degree of membership value will be considered as X1.

4  Proposed Methodology

4.1 Fuzzy System

Our proposed system recommend the diet for type-1, type-2, and prediabetes patients with different variations.


Figure 2: Fuzzy logic system architecture

Fig. 2 explains fuzzy logic system architecture in which rule base contains the set of rules that provided the expert system according to the IF-THEN conditions. Rule base basically defines the decision-making logic of the system. Fuzzification is used to convert system input i.e., crisp number into fuzzy logic sets. The inference engine evaluates and explains the matching degree values of the set according to the current fuzzy input with respect to each rule base.


Figure 3: Input and output of NDES-MFIS expert system

μNDES=NDES[μG,μD,μAG,μAF,μB,μAF] (4)

Defuzzification converts input fuzzy sets into a crisp value by obtaining inference engine methods. These methods are available in the specific expert system to reduce the error. Fig. 3 explains the input and output of the fuzzy system.

4.2 Knowledge Base Input and Output Fuzzy System

Five input variables and one output variable including gender, diabetes type, age group, activity factor, BMI, and calories food plan respectively used for simulations. Fuzzy variable diabetes has three fuzzy terms, namely, Type-1, Type-2 and Prediabetes. Details of input variables are shown in Tab. 6.


4.3 Member Function

Membership functions in fuzzy logic can be identified as Boolean logical operators, which involve predicates expressing in parametric form the existence or nonexistence of the conditional. Fuzzy logic uses a predicate notation to encode the meaning of fuzzy logic formulas, which are firstly like standard Boolean logic. But then operators are also defined as the fuzzy logic operators, which imply some predicates. In particular, membership functions represent the exact values that are expected in a particular case and are often used to perform mathematical operations on such a data set. Membership functions for the proposed system are given in Tab. 7.

4.4 Rule-Based

Fuzzy rule-based systems are so flexible and extensible, it gives decision power with input and output shapes and fuzzy logic types. Fuzzy rules represent the different forms of knowledge in expert systems according to multiple conditions.


ND-MIFS expert system Input/Output variables play the main role in the fuzzy system. The excellent performance of an expert system depends upon these I/O rules that are shown in Fig. 4.

4.5 Defuzzification

Defuzzification is the instrument and formation of producing a computable or quantitative result in crisp logic, given fuzzy logic sets and interrelated membership degrees. It is also called a decision-making algorithm that selects the best crisp input and output value based on a fuzzy set. Figs. 57 shows the De-Fuzzifier graphical representation of NDES-MFIS expert system. In Fig. 4 the rule surface shows different colors, the bluish color shows the age factor and BMI interpretation values of the patient. The greenish color represents all types of diabetic patients.


Figure 4: Input and output rules for NDES-MIFS expert system

The yellowish color represents the calorie requirement per day for diabetic patients on the basis of age and BMI interpretation in Fig. 5.


Figure 5: Predicted control curved surface inputs (X-BMI and Y-Age) output (Calories food plan)

In Fig. 6, the bluish color shows the age factor of the patient. The greenish color represents all types of diabetic patients. The yellowish color represents the calories requirement per day for diabetic patients on the basis of age group and gender.


Figure 6: Predicted control curved surface inputs (X-Age and Y-Diabetes) output (Calories food plan)

In Fig. 7, the bluish color shows the age factor of the patient. The greenish color represents the gender type. The yellowish color represents the calories requirement per day for the diabetic patients on the basis of types of gender type and age group.


Figure 7: Predicted control curved surface inputs (X-Age and Y-Gender) output (Calories food plan)

4.6 Diet Plan Recommendation

Our system has sorted and categorized five major groups including Vegetables, Dairy, Grains, Proteins, and Fruits. The nutrients are selected based on daily allowances including micronutrients and essential dietary elements using fuzzification.

Food group for above-average category (Plan 1, 2, 3)

•   Vegetables are Vitamin A, B, Fiber, and Potassium.

•   Grain are Vitamin-B, Minerals, Fiber, and Carbohydrate.

•   Dairy products are Protein, Potassium, and Calcium.

•   Proteins are Fat, Protein, Phosphorus, and Zink.

•   Fruits. Vitamin A, C, Potassium,

Food group for average category (Plan 2, 3, 4)

•   Vegetables are Vitamin E.

•   Grain products are Protein, Iron.

•   Dairy products are Fat, Vitamin A.

•   Proteins Potassium.

•   Fruits Carbohydrate, Fiber.

Food group for below average category (Plan 3, 4, 5)

•   Vegetable Fat, Calorie, Carbohydrate.

•   Grain products are Fat.

•   Dairy Zinc, Magnesium.

•   Proteins, Carbohydrate, Iron

•   Fruits Fat, Sodium

Local market food items are categorized according to the local market surveys. Low price food items are the ones, which have amount per price ratio higher than high price food collections. Largely accessibility of foods has been considered in categorizing price of local food item.

4.7 Experimental Results

For simulation results, a tool MATLAB R2017 is used. MATLAB is a high-performance language for technical computing. It allows programming in a high-level way while providing a small footprint, efficient execution, and long-term memory use. MATLAB is used for numerical calculations, image processing, data visualization, and scientific computing.


Figure 8: Lookup diagram of diabetes type-1 patient with underweight BMI Interpretations

Fig. 8 defines the rules that If (Gender is Female) and (Age is Group_1) and (Diabetes is Type-1) and (Activity is Sedentary) and (BMI is Underweight) then (Caloris-Foodplan is Plan1).


Figure 9: Lookup diagram of diabetes type-2 patient with overweight BMI interpretations

Fig. 9 defines the rules that If (Gender is Male) and (Age is Group_2) and (Diabetes is Type-2) and (Activity is Moderate) and (BMI is overweight) then (Calories-Floodplain is Plan3).


Figure 10: Lookup diagram of diabetes type-2 patient with obese BMI Interpretations

Fig. 10 shows the rules that If (Gender is Female) and (Age is Group_2) and (Diabetes is Type-2) and (Activity is Moderate) and (BMI is Obese) then (Caloris-Foodplan is Plan4).


Figure 11: Lookup diagram of prediabetes patient with normal BMI interpretations

Fig. 11 shows the rules that If (Gender is Male) and (Age is Group_4) and (Diabetes is Type-2) and (Activity is Active) and (BMI is Normal) then (Caloris-Foodplan is Plan5).

5  Nutrition Diet Expert System

For nutrition diet expert system, height and weight of the diabetic patient and BMI calculations is compulsory. After calculating the BMI of the patient, resultant passed the parameter values of the patient like gender, type of diabetes, age, BMI, Activity factor in the nutrition diet expert system in Tab. 8.


Figure 12: Diabetic patient information in nutrition diet expert system


In Fig. 12 shows the Nutation Diet Expert System in which patient information entry like First Name, Last Name, TagID, Diabetes Type, Age, and Calorie, after submitting the information of the patient.


Figure 13: Prediction of diet plan

Fig. 13 shows the NDES in which patient’s Diabetes Type, Age, and Calories, after validating the information in Fig. 12 show the recommendation of the diet plan chart for the diabetic patient and also can see the categories of the diet plan in five major groups’ vegetables, dairy, grains, proteins, and fruits.

6  Conclusion

This paper proposed an expert agent system for diabetes patients and that also recommends a diet plan according to the individual energy requirements. The required information related to domain knowledge is kept in an expert system database and the personal food recommendations. The result of experiments shows that our expert agent system is pretty competent at recommending food plans for individual patients according to their health condition and complication degree of diabetes. The fuzzy enhanced set introduced to create accurate results and correct predicted diet plans. Besides, in an enhanced version of the expert system, adaptive learning skills imparted in proposed system to improve the working and functionality of our expert agent system.

Acknowledgement: Thanks to our families and colleagues for providing moral support.

Funding Statement: The authors received no specific funding for this study.

Conflicts of Interest: The authors declare that they have no conflicts of interest to report regarding the present study.


 1.  A. Jara, J. Zamora and A. Skarmeta, “An internet of things-based personal device for diabetes therapy management in ambient assisted living,” Personal and Ubiquitous Computing, vol. 15, no. 4, pp. 431–440, 2016. [Google Scholar]

 2.  C. Jeon, Y. Haan, C. Heng, C. Clayton, E. Mayeda et al., “Helicobacter pylori infection is associated with an increased rate of diabetes,” Springer Plus, vol. 35, no. 3, pp. 520–525, 2015. [Google Scholar]

 3.  V. Balpande and R. Wajgi, “Review on prediction of diabetes using data mining technique,” International Journal of Research and Scientific Innovation (IJRSI), vol. 4, pp. 43–46, 2018. [Google Scholar]

 4.  J. Okemah, J. Peng and M. Quiñones, “Addressing clinical inertia in type 2 diabetes mellitus,” Advances in Therapy, vol. 35, no. 11, pp. 1735–1745, 2018. [Google Scholar]

 5.  S. Ashraf, C. Roe and N. Bansal, “Green diabetes mellitus: A pilot project,” Journal of Primary Health Care, vol. 11, no. 4, pp. 367–372, 2018. [Google Scholar]

 6.  Oguntibeju, “Type 2 diabetes mellitus, oxidative stress and inflammation: Examining the links,” International Journal of Physiology, Pathophysiology and Pharmacology, vol. 11, no. 3, pp. 45–51, 2018. [Google Scholar]

 7.  A. Afshin, P. Sur, K. Fay and M. Afarideh, “Health effects of dietary risks in 195 countries, a systematic analysis for the global burden of disease study,” Lancet, vol. 393, pp. 1958–1972, 2018. [Google Scholar]

 8.  F. Zhang, F. Cudhea, Z. Shan, H. Eom and D. Kim, “Preventable cancer burden associated with poor diet in the United States,” JNCI Cancer Spectrum, vol. 3, no. 2, pp. 34–44, 2020. [Google Scholar]

 9.  F. Ali, S. Islam, D. Kwak, P. Khan and S. Kwak, “Type-2 fuzzy ontology-aided recommendation systems for IoT-based healthcare,” Computer Communications, vol. 119, pp. 138–155, 2018. [Google Scholar]

10. P. Brzan, E. Rotman, M. Pajnkihar and P. Klanjsek, “Mobile applications for control and self management of diabetes: A systematic review,” Journal of Medical Systems, vol. 40, no. 9, pp. 210–223, 2019. [Google Scholar]

11. M. Geszychter, B. Nassar and F. Gauthier, “A model of a multi-agent web system for integration in expert systems,” IEEE Proc. of Int. Conf. on Intelligent Agents Web Technologies and International Commerce, Vienna, Austria, vol. 27, pp. 90, 2016. [Google Scholar]

12. N. Bruevich, A. Ivashkin and M. Nikitina, “Information technology in the mobile application of analysis and correction of the diet of individual healthy nutrition,” in IEEE Signals Generating and Processing in the Field of on Board Communications, Moscow, Russia, vol. 50, pp. 1–5, 2019. [Google Scholar]

13. C. Chen, M. Karvela, M. Sohbati, M. Shinawatra and C. Toumazou, “PERSON—Personalized expert recommendation system for optimized nutrition,” IEEE Transactions on Biomedical Circuits and Systems, vol. 12, no. 1, pp. 151–160, 2019. [Google Scholar]

14. M. Hazman and M. Idrees, “A healthy nutrition expert system for children,” IEEE Proc. of E-Health and Bioengineering Conf., Romania, vol. 123, pp. 1–4, 2015. [Google Scholar]

15. D. Ratnawati, “Mobile-based expert system for human diet planning using optimum neighbor,” in Proc. of Int. Conf. on Advanced Computer Science and Information Systems (ICACSISCanada, pp. 283–287, 2016. [Google Scholar]

16. M. Shamim, S. Enam and U. Qidwai, “Fuzzy logic in neurosurgery: Predicting poor outcomes after lumbar disk surgery in 501 consecutive patients,” Surgical Neurology, vol. 72, no. 6, pp. 565–572, 2019. [Google Scholar]

17. Z. Zrubka and M. Péntek, “Using digital technologies in the measurement of health outcomes,” in World Sym. on Applied Machine Intelligence and Informatics (SAMIHerl'any, Slovakia, pp. 13–14, 2021. [Google Scholar]

18. F. Khan and K. Meehan, “Diabetes prognosis using white-box machine learning framework for interpretability of results,” in Proc. of Computing and Communication Workshop and Conf. (CCWCNV, USA, pp. 1501–1506, 2021. [Google Scholar]

images This work is licensed under a Creative Commons Attribution 4.0 International License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.