Open access peer-reviewed chapter

Selecting Intermittent Fasting Type to Improve Health in Type 2 Diabetes: A Machine Learning Approach

Written By

Shula Shazman

Submitted: 02 June 2020 Reviewed: 02 December 2020 Published: 03 January 2021

DOI: 10.5772/intechopen.95336

From the Edited Volume

Type 2 Diabetes - From Pathophysiology to Cyber Systems

Edited by Anca Pantea Stoian

Chapter metrics overview

627 Chapter Downloads

View Full Metrics


Intermittent fasting (IF) is the cycling between periods of eating and fasting. The two most popular forms of IER are: the 5: 2 diet characterized by two consecutive or non-consecutive “fast” days and the alternate-day energy restriction, commonly called alternate-day fasting (ADF). The second form is time-restricted feeding (TRF), eating within specific time frames such as the most prevalent 16: 8 diet, with 16 hours of fasting and 8 hours for eating. It is already known that IF can bring about changes in metabolic parameters related with type 2 diabetes (T2D). Furthermore, IF can be effective in improving health by reducing metabolic disorders and age-related diseases. However, it is not clear yet whether the age at which fasting begins, gender and severity of T2D influence on the effectiveness of the different types of IF in reducing metabolic disorders. In this chapter I will present the risk factors of T2D, the different types of IF interventions and the research-based knowledge regarding the effect of IF on T2D. Furthermore, I will describe several machine learning approaches to provide a recommendation system which reveals a set of rules that can assist selecting a successful IF intervention for a personal case. Finally, I will discuss the question: Can we predict the optimal IF intervention for a prediabetes patient?


  • machine learning
  • decision tree
  • type 2 diabetes
  • insulin resistance
  • precision medicine
  • intermittent fasting

1. Introduction

Obesity is an epidemic in developed countries. The obesity epidemic is increasing its magnitude and its public health impact. In 2017–2018, 67% of the population in Australia were overweight or obese [1]. In the United States, only minority of the individuals have a healthy weight (body mass index (BMI) of 18.5–25 kg/m2, [2]. Furthermore, according to the World Health Organization (WHO), nearly 2 billion adults are overweight and more than 600 million patients are obese [3]. Type 2 Diabetes (T2D) is one of the chronical diseases associated with Obesity. T2D is usually characterized by insulin resistance (IR) [4]. Insulin resistance (IR) happens when the body does not fully respond to insulin. IR level can be used as a filtering index for primary T2D prevention. IR can be measured by using the homeostatic model assessment of insulin resistance (HOMA-IR) equation. HOMA-IR can be evaluated by fasting glucose and insulin levels. People with T2D commonly have High HOMA-IR score, which indicates significant insulin resistance [5, 6, 7].

As little as 3% weight reduction produces clinically significant effects to reduce HOMA-IR [8, 9]. The most widely prescribed strategy to induce weight loss is to reduce the daily calory intake [10]. Current guidelines recommended continuous energy restriction (CER) along with comprehensive lifestyle intervention, as the cornerstone of obesity treatment [11]. For some individuals CER are effective for weight loss. However, many people realize that this type of diet is difficult to follow, as it requires robust calorie counting, and frustration is caused be owing to the feeling of never being able to eat freely.

There has been increased interest in identifying alternative dietary weight loss strategies, because of the relative ineffectiveness of traditional CER approaches for achieving and sustaining weight loss. One such approach is intermittent fasting (IF) also called intermittent energy restriction (IER) which encompasses various diets that cycle between periods of fasting and no fasting, these diets do not necessarily specify what to eat. The regimens of IER may be easier to follow and maintain over time than CER. Furthermore, people do not fully compensate during fed periods for the lack of energy created during prolonged periods of fasting. Therefore, IER may lead to metabolic adjustments that prefer greater fat mass loss, better maintaining of lean mass, and weight loss [12, 13].

The IER regimens range from fasting the whole days at a time to fasting for several hours during the day. IER paradigms involve recurring periods with little or no energy intake with intervening periods of ad libitum food intake. The two most popular forms of IER are: the 5: 2 diet characterized by two consecutive or non-consecutive “fast” days and the alternate-day energy restriction, commonly called alternate-day fasting (ADF). The second form is time-restricted feeding (TRF), eating within specific time frames such as the most prevalent 16: 8 diet, with 16 hours of fasting and 8 hours for eating.

Previous studies and systematic reviews provide an overview of IER regimes [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]. Those studies report the health benefits leading by IER regimes and discuss the physiological mechanisms by which health outcomes might be improved [35]. However, the question of whether IER is always able to reduce HOMA-IR is not answered by the latter studies; In other words, what are the conditions (age, gender, basal fasting glucose level, etc.) needed to make the IER effective for reducing HOMA-IR have not yet been deciphered. Moreover, results of previous studies are reported on a group level only rather than report per individual.

In today’s era of precision medicine, we can be motivated to answer the question Can we predict who will be Successful on an IMF or TRF Diet or CER? For example, a patient with prediabetes or diabetes comes to see his physician to ask for advice. Could such patient benefit from a specific IF intervention? Benefit in terms of reducing HOMA-IR or even eliminating the T2D altogether. A recommendation system which suggest effective IF intervention for a certain patient is found in a new study [36]. The recommendation system is based on individual data from human fasting intervention studies. The system presented in the study, predicts which type of IF treatment can improve an individual’s health and preventing or curing T2D. A machine learning approach is used to develop the recommendation system while a set of rules which can assist individual patients and their physicians in selecting the best IF intervention is provided by the results of the study.

A further question will be discussed in this chapter: Can we predict the optimal intervention IMF or TRF Diet or CER or other for a prediabetes patient? and what is the accuracy of such prediction?


2. Type 2 diabetes (T2D)

Diabetes is a chronic, metabolic disease characterized by elevated levels of blood glucose (or blood sugar). Our metabolism converts food into energy for our bodies to use. One of the things needed for this process is insulin. The pancreas makes a hormone called insulin. The insulin helps the cells turn glucose from the food we eat into energy. After we eat, the sugar levels in our blood rise and insulin is released into the bloodstream. The insulin then makes the cells absorb sugar from the blood. If this process does not work properly, the blood sugar levels rise. The medical term for blood sugar levels that are too high is hyperglycemia.

According to the International Diabetes Federation in 2017 there were 425 million people in the world with diabetes. That is close to 1 in 11 people [37].

2.1 Main types of diabetes

There are two main types of diabetes: type 1 and type 2. Glucose gives the body cells energy, but to enter the cells it needs insulin. People with type 1 diabetes do not produce insulin; while people with T2D do not respond to insulin as well as they should. Both types of diabetes can lead to chronically high blood sugar levels. Type 1 diabetes usually develops in childhood or teenage years. This disease is a result of damage to the pancreas that leaves it producing either very little insulin or none. Type 1 diabetes is caused by an autoimmune reaction where the body’s defense system attacks the cells that produce insulin. Things are different in T2D, where insulin is made by the pancreas, but the body’s cells lose the ability to absorb and use the insulin. In people who have T2D, the pancreas produces enough insulin, but it no longer influences the body’s cells. The medical term for this is “insulin resistance” (IR). The pancreas can compensate for this for a while by producing more insulin. But at some point, it can no longer keep up, and then blood sugar levels start to rise. T2D is characterized by (IR), where the body does not fully respond to insulin. In the past, T2D was often referred to as “adult-onset” diabetes because it is commonly diagnosed later in life. T2D is much more common than type 1 diabetes. Among all the people living with diabetes, 90–95% percent have T2D. This chapter focuses on T2D.

2.2 Causes and risk factors

Usually, a combination of things causes T2D. There are several gene mutations linked to diabetes. Not everyone who carries a mutation will get diabetes. However, many people with diabetes do have one or more of these mutations. Being overweight or obese can cause IR. People with insulin resistance often have a group of conditions commonly called “Metabolic syndrome”, including high blood sugar, extra fat around the waist, high blood pressure, high cholesterol and high triglycerides. Another cause can be bad communication between cells. Sometimes, cells send the wrong signals or do not pick up messages correctly. When these problems affect how cells make and use insulin or glucose, a chain reaction can lead to diabetes. Finally, broken beta cells can cause diabetes since if the cells that make insulin send out the wrong amount of insulin at the wrong time, blood sugar is not controlled properly.

Various factors can increase the likelihood of developing T2D. They can be described using 3 categories. The category of risk factors is who you are: age of 45 or older, a family relative with diabetes or ethnicity. The second category is health and medical history: being prediabetes can increase the risk for diabetes, heart and blood vessel disease, high blood pressure, low HDL (“good”) cholesterol, high triglycerides, being overweight or obese, Gestational diabetes while you were pregnant and finally depression. The last category of risk factors is the daily habits and lifestyle. Among this category we can find factors such as getting little or no exercise, smoking, stress or sleeping too little or too much.

2.3 Symptoms and complications

T2D can evolve moderately during several years. Blood sugar levels stay high all the time when T2D is untreated. High blood sugar levels may cause the following symptoms: thirstiness, frequent urination, tiredness and apathy, fulsomeness and dizziness or even lose consciousness. In addition to T2D symptoms there are complications of T2D containing, five times more likely to get heart disease or have a stroke, dialysis, or kidney replacement in case the kidneys are damaged. Furthermore, high blood sugar can damage the small blood vessels in the backs of the eyes and in cases of neglect, it can cause blindness. Digestive disorders, not feeling of the feet and sexual response are considered as T2D complications as well. Lesions cure slower and can become infected when blood does not circulate well. Miscarriage are more likely in women with diabetes. A condition in which breathing stops and starts while you sleep might developed. It is more likely to have hearing problems. Finally, high blood sugar can damage your brain and might put you at higher risk of Alzheimer’s disease.

2.4 How does T2D diagnosed?

Hemoglobin is a protein that transports oxygen to the body cells. It can be found inside red blood cells. In cases of high glucose level in the blood glucose can attach the hemoglobin. Hemoglobin that is attached to glucose is called glycated hemoglobin. T2D diabetes is usually diagnosed using the A1C test. A1C test measures the amount of hemoglobin in the blood that has glucose attached to it.

Red blood cells are constantly dying and regenerating. Their lifespan is approximately three months. Glucose attaches (glycates) to hemoglobin inside the red blood cells, so the record of how much glucose is attached to the hemoglobin also lasts for about three months. Normally, about 6 percent of hemoglobin has glucose attached. If there is too much glucose attached to the hemoglobin cells, the test results will be high A1C. If the amount of Glycated hemoglobin amount is normal, the A1C results will be normal. An A1C level of 6.5 percent or higher on two separate tests means you have diabetes.

The symbol A1C represents a specific type of hemoglobin. The “A” in Hemoglobin A (HgbA) stands for “adult.” HgbA can be found in two types HgbA1 and HgbA2. In individuals from six months old about 98% of HgbA is type 1 (HgbA1). Type A1 has subtypes A1A, A1B, A1C, and others. Two-thirds of hemoglobin with glucose attached is type A1C [38]. Therefore, HgbA1C is a good marker for glucose control. Larger amount of hemoglobin will be glycated when more glucose is circulating in the blood.

However, the A1C test results are not always meaningful. For example, when we want to measure A1C difference before and after an intervention that is shorter than three months. The difference of A1C before and after the intervention will not tell us the accurate result because it is an average calculation. In such case we need another test to diagnose the glucose level in blood. Fasting blood glucose test is a blood sample which is taken after an overnight fast. A normal level of fasting glucose is a reading of less than 100 mg/dL (5.6 mmol/L). If the fasting blood glucose is 126 mg/dL (7 mmol/L) or higher, it considered diabetes. Values between 100 to 125 considered prediabetes. T2D is generally characterized by insulin resistance, where the body does not fully respond to insulin.

HOMA-IR stands for Homeostatic Model Assessment of Insulin Resistance. Using HOMA-IR equation insulin resistance can be estimated from fasting glucose and insulin levels. High score of HOMA-IR indicates a significant Insulin resistance which usually found in people with Diabetes Type 2. An updated HOMA model (HOMA2) was published by Jonathan Levy in 1998. HOMA2 model took account of variations in hepatic and peripheral glucose resistance, increases in the insulin secretion curve for plasma glucose concentrations above 10 mmol/L (180 mg/dL) and the contribution of circulating proinsulin [39]. In 2004, the HOMA2 Calculator [40] was released by Oxford university UK. This provides quick and easy access to the HOMA2 model for researchers who wish to use model-derived estimates of Insulin resistance, rather than linear approximations as provided by HOMA-IR model. There are additional tests to diagnose Diabetes type 2,beside those mentioned here, however those methods will not be discussed further in this chapter.

2.5 How is T2D treated?

There are two approaches to treat T2D. The first is lifestyle changes and the second is medications. Adopting a healthy lifestyle can help lower the risk of diabetes. Healthy life style contains: lose weight, get active, eat right, avoid highly processed carbs, sugary drinks, and trans and saturated fats, limit red and processed meats, quit smoking and finally work to keep from gaining weight after you quit smoking, so you do not create one problem by solving another. It is possible to reach your target blood sugar levels with diet and exercise alone. However, if changing lifestyle is not enough several medicines exist to treat diabetes. Among the medicine functions are: Lowering the amount of glucose your liver makes and helps your body responding better to the insulin. Helping your body make more insulin, making you more sensitive to insulin. Causing slow digestion and lowering blood sugar levels and finally help your kidneys filter out more glucose.


3. Intermittent fasting

In historical periods in the past when food was not always available fasting was sure to happen. Many religious philosophies have practiced fasting for centuries; however, cyclically restricting or reducing calories has recently taken off as a way to lose weight and improve health outcomes. Intermittent fasting (IF) is proposed as an alternative dieting strategy. IF includes cycles of fasting and unrestricted eating periods, which may allow more flexibility and thereby enhance devoutness [41]. Intermittent fasting is generally grouped into two main categories: whole-day fasting and time-restricted feeding. Both categories range in flexibility of time spent fasting. The details of intermittent fasting interventions which participate in the research described in this chapter are found in the following subsections.

3.1 Continuous energy restriction (CER)

In a paper from 2011 [42] Michelle Harvie describes a randomized controlled trial to compare the feasibility and effectiveness of intermittent continuous energy (IER) with continuous energy restriction (CER) for weight loss, insulin sensitivity and other metabolic disease risk markers. The CER involved a 25% energy restriction from estimated baseline energy requirements using reported metabolic energy turnovers estimated basal metabolic rate [43] for 7 days per week. The CER group was prescribed a daily 25% restriction based on a Mediterranean-type diet (30% fat, 15% monounsaturated, 7.5% saturated fat, 7.5% polyunsaturated fatty acids, 45% low glycemic load carbohydrate and 25% protein) [44].

3.2 Intermittent energy restriction (IER)

The IER group from the randomized controlled trial in Harvie’s paper [42] took a very low-calorie diet (VLCD) (75% restriction) on two consecutive days and for the remaining 5 days consume food for weight maintenance. The VLCD provided 2700 kJ of energy and 50 g protein per day, four portions of vegetables (~80 g per portion), one portion of fruit, a salty low-calorie drink and a multivitamin and mineral supplement. The duration of the intervention was six months.

3.3 Daily morning fasting (DMF)

Daily morning fasting is based on the Bath Breakfast Project (BBP) [45]. BBP is a randomized controlled trial comparing the effects of daily breakfast consumption relative to extended fasting on energy balance and human health. In a randomized cross-over design, obese men and women extended their overnight fast by omitting breakfast consumption or ingesting a typical carbohydrate-rich breakfast of (521 ± 94 kcal), before an ad libitum pasta lunch 3 h later. The duration of intervention was 4 weeks.

3.4 Fasting every second day (FESD)

Fasting every second day (FESD) was experienced in a paper of Nils Halberg [46]. The duration of the intervention was 14 days of fasting every second day for 20 h, giving seven fasting periods. Each fasting period started at 22:00 and ended at 18:00 the following day. During the fasting periods, the subjects could drink water and were instructed to maintain habitual activities.

3.5 Intermittent energy and carbohydrate restriction (IECR)

Another IER approach is tested in the paper of Michelle Harvie from 2013 [47]. The test in latter paper included two intermittent energy and carbohydrate restriction (IECR) regimens, including one which allowed ad libitum protein and fat (IECR PF). Overweight 115 women were randomized to an overall 25% energy restriction, either as an IECR (2500–2717 kJ/d,40 g carbohydrate/d for 2 d/week) or a 25% daily energy restriction (DER – which is type of CER - approximately 6000 kJ/d for 7 d/week) or an IECR PF for a 3-month weight-loss period and 1 month of weight maintenance (IECR or IECR PF for 1 d/week).


4. The steps in machine learning

This study described in this chapter aims to predict whether a specific IF intervention would reduce the insulin resistance of an individual with prediabetes. The approach to answer this question is machine learning. The process of machine learning is composed of 5 major steps: The first is identifying the required data and gathering data from various sources. The next step is preparing and Pre-processing the data to have homogeneity. Then the model must be built by selecting the right Machine Learning classifier. The fourth step is to train and test the data and gain insights from the model results. Finally, we might want to improve results by feature selection for example.

4.1 Identifying required data

In order to answer the question of this study, authors of 25 published papers that performed randomized clinical trials investigating the IF effects on T2D parameters were asked for the individual data. I received the individual data from 5 out 25 papers [42, 45, 46, 47, 48]. The other authors replied that they could not submit the data due to the confidentiality of the participants.

4.2 Processing the data

4.2.1 Choosing people

The selection criteria for this research were: basal fasting glucose above 5 mmol/L (90 mg/dL) or BMI (Body Mass Index) above or equal to 25. Those criteria were established since they indicate possible prediabetes [49]. The IDF’s 2019 cutoff for fasting glucose indicating prediabetes is 100 mg/dL; we set the cutoff at 90 mg/dL. Finally, 254 individuals who answered the criteria were selected. Table 1 contains the average values of the numerical attributes of the data. The average values show decrease in weight, BMI, fasting glucose and fasting insulin however we should remember that those are averages therefore we cannot conclude that all the interventions work all the time for all the people. This would be the query that the machine learning approach will investigate.

AgeWeightBMIFasting glucose (mmol/liter)Fasting insulin (pmol/liter)

Table 1.

Average values of attribute in selected data.

4.2.2 HOMA-IR equation

The Homeostatic Model Assessment of Insulin Resistance (HOMA-IR) has been proven to be a very sensitive test for indicating prediabetes [8]. Insulin resistance can be estimated from fasting glucose and insulin levels. This is shown in the HOMA-IR equation presented as follows:


Prediabetes people or people with T2D usually have a significant insulin resistance. A high score of HOMA-IR indicates a significant insulin resistance. To learn the difference of HOMA-IR before and after the intervention the HOMA-IR using (Eq. (1)) was calculated twice for each of the 254 individuals. Once HOMA-IR was calculated for the basal values of fasting glucose and insulin and once for the values after the intervention. The difference between them represents the insulin resistance reduction.

4.2.3 Types of intermittent fasting interventions

This study contains 9 different types of interventions, starting from continuous energy restriction – through intermittent energy restriction for two days a week, or daily morning fasting or fasting every second day. Part of the interventions contained specific diets. The names of the different types of the interventions and their description are found in Table 2 below.

Intervention nameDetailsCER\IERDurationReference
CERContinuous energy restriction - 7 days a week trailCER24 weeks[42]
IERIntermittent energy restriction - 2 days a week trailIER24 weeks[42]
DMFDaily Morning FastingIER4 weeks[45]
FESDFasting Every SecondIER2 weeks[46]
IECRIntermittent Energy and Carbohydrate RestrictionIER24 weeks[47]
IECR+PFIntermittent Energy and Carbohydrate Restriction + free protein and fatIER24 weeks[47]
DERDaily Energy RestrictionCER24 weeks[47]
High CarbHigh Carbohydrate weight loss dietCER12 weeks[48]
High MonoHigh Monounsaturated weight loss dietCER12 weeks[48]

Table 2.

IF regimens.

Table 2 summarizes the different IF regimens included in this study. The reference to each regimen is also shown in Table 2 for further details.

4.2.4 Individual’s features

The data collected for each individual in this study contained details regarding the age, gender, weight, ethnicity, basal BMI, basal fasting glucose, fasting glucose after intervention, basal fasting insulin and fasting insulin after intervention. Details of the intervention such as intervention’s name and duration were also included for each individual. For being able to train and learn from the data the features ‘fasting glucose after intervention’ and ‘fasting insulin after intervention’ must be excluded. A calculated feature named ‘HOMA-IR difference’ was added to the training vector. This feature was calculated as follows: if the intervention is successful we expect a reduction in HOMA-IR; thus, if the HOMA-IR difference is greater than zero the assignment in the ‘HOMA-IR difference’ column is set to TRUE otherwise it is FALSE. The final training vector included the ten following features: age, gender, weight, ethnicity, basal BMI, basal fasting glucose, basal fasting insulin, intervention’s name, intervention’s and HOMA-IR difference.

4.3 Building a model from the data

The problem of the study describe here is a classification question. Can we predict whether an intermittent fasting intervention will be useful to improve T2D risk parameters for a certain individual? Classification is a data mining technique which solve problems by analyzing large volumes of data. Furthermore, classification is the process of finding a model that describes and differentiates data classes, where the ultimate goal is being able to use the model to predict the class of an instance whose label is unknown. Decision trees are kind of algorithm that can be used for classification, while additional algorithms which can be used for this purpose are neural networks, naïve bayes, logistic regression and others. However, the decision tree classification with the Waikato Environment for Knowledge Analysis (Weka) is the simplest way to mine information from a database. Furthermore, decision trees can deal with a large variety of feature types like binary, nominal, ordinal, categorial and numeric like those found in our mixed dataset [50]. Finally, decision trees are an intuitive way of representing a sequence of rules that lead to a class or value. The decision tree output is a flowchart-like tree structure. The decision tree algorithms J48, LMT (Logistic Model Tree), Random Forest and Random Tree as well as the Logistic Regression and Naïve Bayes classifiers were tested on the data in this study.

4.4 Training and testing

The next step was training the dataset (254 individuals) and building models using six different classifiers: J48 decision tree, Logistic Model Tree, Random forest, Random tree, Logistic and Naïve Bayes. The optimal number of features as a function of sample size is proportional to √n (n is the sample size) for highly correlated features [51]. The features in the study shown here are highly correlated and √254 = 15.9 while the number of features is 9 (i.e. 9 attributes for 254 individuals is reliable). Following the training comes the testing. Two test approaches were selected to validate the model – the leave-one-out and the 10-fold cross validations. In the leave-one-out approach you test every individual by excluding it from the training set, train the 253 left individuals and then test the excluded one. This happens 254 times, namely for every individual in the dataset. The 10-fold cross validation test approach divide the dataset into 10 groups equal in size. Then for ten times train and build the model with nine of the groups together and test the individual found in the 10th excluded group.


5. Decision rules for health benefit due to intermittent fasting

5.1 Prediction whether HOMA-IR decreases

When measuring performance of machine learning classifiers, accuracy is not enough. For comparing results from different classifiers, we need an additional measure. The additional measure is based on the definition of four groups resulted when solving a classification. For example, in our case when the case is that there is a reduction in HOMA-IR then the TRUE-POSITIVE (TP) group is when the prediction is correct, while the FALSE-POSITIVE (FP) group is when the prediction is not correct. The two additional groups found when the case is that there is no HOMA-IR reduction then TRUE-NEGATIVE (TN) will be when the prediction is false in other words the prediction is correct; however, when the prediction is not correct we say it is the FALSE-NEGATIVE (FN). The additional measure to compare between different classifiers is Area Under Curve (AUC) measure. AUC presents the relation between the TP rate and the FP rate and it is a very useful in the comparison between classifiers. The value of AUC ranges between 0 to 1. AUC equals 1 means a perfect classifier TP = 1 and FP = 0, while random classifier is when AUC is equal approximately to 0.5.

The AUC of the six different classifiers – J48, LMT, Random Forest, Random Tree, Logistic Regression and Naïve Bayes using the two test methods mentioned in the previous paragraph – are shown in Table 3. The AUC of the 10-Fold test is shown in the first row of Table 3 while the Leave-One-Out test is found in the second row. For both tests the AUC differences between the classifiers are very small (0.67 to 0.75 in the 10-fold and 0.65–0.8 in the leave-one-out); we therefore conclude that all six classifiers perform similarly. The advantage of Random Forest is to prevent overfitting by creating random subsets of the features and building smaller trees and then combining the subtrees, however J48 is shown to yield the most accurate prediction within the decision tree algorithms [50]. In addition, J48 explains itself and easy to follow. In the J48 decision tree, the internal nodes are the different features (age, gender, weight, etc.), the branches between the nodes represent the possible values that these features may have (age: lower than 18 or equal higher than 18, gender: male/female, etc.). The terminal nodes tell us the final value of the prediction(TRUE or FALSE assigned for HOMA-IR difference). As shown in Table 3 using J48 classifier and the 10-fold cross validation test the model AUC is 0.7. Furthermore, the Leave-One-Out test achieves AUC of 0.8. Therefore, the J48 model successfully predicts whether an intervention would help an individual improve his T2D risk parameters by reducing HOMA-IR.

J48LMTRandom ForestRandom TreeLogisticNaive Bayes
Leave-One- Out0.80.740.740.660.790.72

Table 3.

AUC for different classifiers.

The visualization of the J48 decision tree is found in Figures 14. Interestingly the attribute gender is the first node in the tree, as shown in Figures 1 and 2. Having the gender as the first splitting attribute indicates that this attribute is the most informative one for the decision. Moreover, for males the duration of the intervention is the most important attribute to decide the effectiveness of the intervention (Figure 1); while for females the basal fasting insulin level is reported as the most important feature (Figure 2). Green in Figures 14 represents TRUE which indicates success in reducing HOMA-IR while red represents FALSE which indicates no reduction.

Figure 1.

Sub-decision tree – Male side.

Figure 2.

Sub-decision tree – Female side.

Figure 3.

Sub-decision tree – Female left side.

Figure 4.

Sub-decision tree – Female right side.

Analyzing the sub-decision tree of the males’ side shown Figure 1, brings to the conclusion that men are indifferent to the type of the intervention rather they affected by the duration of the intervention. Success of intervention defined by reducing HOMA-IR, can be achieved by short duration of fasting (less or equal to 2.5 weeks) and lower BMI (less or equal to 25.8) or long duration of intervention and age 41 years and younger. Reasonably, attributes like lower BMI and younger age make it easier to reduce HOMA-IR.

Unlike the male side of the decision tree, in the female side the type of intervention is part of the tree and is represented by the nodes of the tree. As shown in Figure 2 the intervention are nodes of the tree which are colored yellow while the nodes that represent attributes are colored blue. Moreover, the view of the tree on the female side consist of many different and connected parts compared with the male side of the tree. The fact that there are more women in the dataset than men can be the reason for this complexity view. The different interventions are part of the decision nodes as shown in Figure 2. The different interventions are arranged hierarchically starting with DMF followed by IECR or beginning with IECR followed by the Hi Mono diet. The success of the different interventions in improving HOMA-IR is shown in Figure 3. The hierarchical structure of the interventions is organized by their success, beginning with DMF, IECR and then IECR+PF. An interesting evidence which should be further investigated is found in Figure 4. That evidence is the node where lower BMI leads to an unsuccessful intervention.

5.2 Testing separately the reduction of fasting glucose or fasting insulin

To find out whether only fasting glucose reduction or fasting insulin reduction taken separately instead of HOMA-IR can be used to predict the usefulness of an intervention two additional train and test process were done. Table 4 summarizes the results of the predictions based once only on fasting glucose reduction and once only on fasting insulin reduction.

HOMA-IR reductionFASTING Glucose reductionFASTING Insulin reduction
10-Fold Cross Validation test0.70.60.55
Leave- One-Out test0.80.60.6

Table 4.

Summary of AUC results for improving T2D risk parameters.

As shown in Table 4 the prediction of improvement in T2D based on HOMA-IR is more effective than the prediction based on fasting glucose or the fasting insulin separately. As shown in Eq. 1, the HOMA-IR calculation is based on both fasting glucose and fasting insulin.

5.3 Comparing results with random classification

An interesting question would be would these results based on HOMA-IR obtain on random? To answer this question, I reordered the values in the HOMA-IR column in an arbitrary way. The ratio between the TRUE values and the FALSE values was identical to the original column. The AUC results of training and testing with random data were much lower compared with the original data. The 10-Fold cross validation test yields 0.56 AUC compared with 0.7 in the original data. The Leave-One-Out test difference in AUC between the random and the original data was even more significant – 0.61 AUC in the random data compared with 0.8 in the original data. Those results answer the question asked above and suggest that the model predictions cannot be obtain in random.

5.4 Testing features redundancy

Another interesting question is whether all the features mentioned in 4.2.4 are needed for the prediction. To test this a feature selection test was performed on the data. In each test a different feature was excluded. The AUC results are shown in Table 5.

Excluded Feature10-Fold Cross Validation testLeave-One-Out test
Basal BMI0.690.77
Fasting Glucose – basal0.650.73
Fasting Insulin – basal0.620.6

Table 5.

Features selection – AUC results of J48 Decision tree.

The feature in every row of Table 5 except of the first row, is excluded and AUC is calculated without this feature. None of the features is redundant since as shown in Table 5 the highest AUC is shown when all features are trained.


6. Conclusions

To achieve steady-state fasting levels for many metabolic substrates which are found in blood draws taken from patients, the patients are required to fast 8–12 hours. This evidence can show us that even a single fasting interval in humans (e.g., overnight) can reduce basal concentrations of metabolic biomarkers related with T2D, such as insulin and glucose. Intermittent fasting regimens may be a promising approach to losing weight and improving metabolic health. Moreover, these eating regimens may offer promising nonpharmacological approaches to improving health in general and specifically improve T2D condition.

The question in this study is not how to lose weight but to answer the question of which of the people suffering from T2D can benefit through an intermittent fasting approach and what is the best type of intermittent fasting for a particular person. This it offers a recommendation system based on data from several clinical trials for answering those questions. The recommendation system selects the optimal intervention to improve the health of prediabetes individuals or people with T2D. The improvement in health reflected in reducing their glucose and insulin levels which are considered T2D risk parameters and composed the HOMA-IR equation. The procedure in this study is built using a machine learning approach and is the results are presented by a decision tree. The conclusions from the decision rules derived from the tree are that males and females have a different set of rules because the node gender comes first in the tree. The success of intervention in males depends on the duration of the IF. Therefore, males are indifferent to the type of intervention. Moreover, males with a smaller BMI will be more likely to have a successful intervention in case the duration of intervention is equal or less than 2.5 weeks. On the other hand, if the duration of the intervention is more than 2.5 weeks for males than age will be important to its success. Reasonably, younger age will serve as a benefit. The level of basal fasting insulin is the most important attribute for a successful intervention in female. There are some cases where no intervention within the dataset of this study can assist in improving HOMA-IR for example if a female with a basal fasting insulin equal or less than 37.1 pmol/L (for moderate insulin resistance the fasting insulin should be in the range of 18–48 pmol/L) and age exceeding 52.

To apply for a wider population additional clinical trail’s data should be used. Moreover, a larger dataset will make it possible, to build a software which would assist physicians in advising an optimal intervention to their patients and by that providing a better personalized medical service to their patients.



I wish to thank Michelle Harvie, Nils Halberg, Flemming Dela, Peter M. Clifton, Eric Ravussin, Leonie Kaye Heilbronn and Enhad Chowdhury for their assistance in this study by sending the individual data from their published clinical trial papers.


  1. 1. Australian Bureau of Statistics. National Health Survey: First Results, 2017-2018 [Internet]. Canberra (ACT): Commonwealth of Australia; 2018 [cited 2019 Oct 25]. ABS cat. no. 4364.0.55.001. Available from:
  2. 2. Ogden, C.L., Carroll, M.D., Kit, B.K., Flegal, K.M. Prevalence of childhood and adult obesity in the United States 2011-2012. JAMA. 2014; 311, 806-814. DOI: 10.1001/jama.2014.732
  3. 3. WHO. 2017. 10 facts on obesity, Accessed September 17, 2019. Available from:
  4. 4. Roy Taylor. Insulin Resistance and Type 2 Diabetes. Diabetes 2012 Apr; 61(4):778-779.
  5. 5. Tang, Q ., Li, X., Song, P. and Xu. L. Optimal cut-off values for the homeostasis model assessment of insulin resistance (HOMA-IR) and pre-diabetes screening: Developments in research and prospects for the future. Drug Discoveries & Therapeutics. 2015; 9(6):380-385. DOI: 10.5582/ddt.2015.01207
  6. 6. Sharma, S. and Fleming, E. Use of HbA1C testing to diagnose pre-diabetes in high risk African American children: A comparison with fasting glucose and HOMA-IR. Diabetes & Metabolic Syndrome: Clinical Research & Reviews 6 (2012): 157-162. DOI: 10.1016/j.dsx.2012.09.004
  7. 7. Dagmar Horáková, Ladislav Štěpánek, Vladimír Janout, Jana Janoutová, Dalibor Pastucha, Helena Kollárová, Alena Petráková, Lubomír Štěpánek, Roman Husár and Karel Martiník. Optimal Homeostasis Model Assessment of Insulin Resistance (HOMA-IR) Cut-Offs: A Cross-Sectional Study in the Czech Population. Medicina (Kaunas). 2019 May; 55(5): 158. DOI: 10.3390/medicina55050158
  8. 8. National Institute for Health and Care Excellence. Weight management: lifestyle services for overweight or obese adults [Internet]. [London]: NICE; 2014 [updated May 2017; cited 2020 Jan 16]. [Public health guideline [PH53]). Available from:
  9. 9. M.D. Jensen, D.H. Ryan, C.M. Apovian, J.D. Ard, A.G. Comuzzie, K.A. Donato, et al.,2013 AHA/ACC/TOS guideline for the management of overweight and obesity in adults: a report of the american college of cardiology/american heart association task force on practice guidelines and the obesity society, J Am Coll Cardiol. 63 (25, Part B) (2014) 2985-3023
  10. 10. Julia C., Peneau S., Andreeva V.A., Mejean C.; Fezeu L., Galan P., Hercberg S. Weight-loss strategies used by the general population: How are they perceived? PLoS ONE 2014, 9, e97834. DOI: 10.1371/journal.pone.0097834
  11. 11. Jensen M.D., Ryan D.H., Apovian C.M., Ard J.D., Comuzzie A.G., Donato K.A., Hu F.B., Hubbard V.S., Jakicic J.M., Kushner R.F., et al. 2013 AHA/ACC/TOS guideline for the management of overweight and obesity in adults: A report of the American College of Cardiology/American Heart Association Task Force on Practice Guidelines and The Obesity Society. Circulation 2014, 129, S102–S138. DOI: 10.1161/
  12. 12. Mattson M.P., Longo V.D., Harvie M. Impact of intermittent fasting on health and disease processes. Ageing Res. Rev. 2017, 39, 46-58. DOI: 10.1016/j.arr.2016.10.005
  13. 13. Ana Luísa and Kremer Faller. Impact of intermittent fasting on the body weight of overweight and obese individuals.
  14. 14. Lukas Schwingshackl, Jasmin Zähringer, Kai Nitschke, Gabriel Torbahn, Szimonetta Lohner, Tilman Kühn, Luigi Fontana, Nicola Veronese, Christine Schmucker and Joerg J Meerpohl. Impact of intermittent energy restriction on anthropometric outcomes and intermediate disease markers in patients with overweight and obesity: systematic review and meta analyses. Critical Reviews in Food Science and Nutrition. 2020. DOI: 10.1080/10408398.2020.1757616
  15. 15. Kai Liu, Bo Liu, Leonie K. Heilbronn. Intermittent fasting: What questions should we be asking? Physiology & Behavior 218. 2020. DOI: 10.1016/j.physbeh.2020.112827
  16. 16. Stephen D. Anton, Stephanie A. Lee, William T. Donahoo, Christian McLaren, Todd Manini, Christiaan Leeuwenburgh and Marco Pahor. The Effects of Time Restricted Feeding on Overweight, Older Adults: A Pilot Study. Nutrients 2019, 11, 1500; DOI:10.3390/nu11071500
  17. 17. Surabhi Bhutani, Monica C. Klempel, Cynthia M. Kroeger, John F. Trepanowski and Krista A. Varady. Alternate Day Fasting and Endurance Exercise Combine to Reduce Body Weight and Favorably Alter Plasma Lipids in Obese Humans. Obesity, 2013, 21, 1370-1379. DOI:10.1002/oby.20353
  18. 18. Jane Bowen , Emily Brindal, Genevieve James-Martin and Manny Noakes. Randomized Trial of a High Protein, Partial Meal Replacement Program with or without Alternate Day Fasting: Similar Effects on Weight Loss, Retention Status, Nutritional, Metabolic, and Behavioral Outcomes. Nutrients 2018, 10, 1145; DOI:10.3390/nu10091145 www.mdpi
  19. 19. S. Carter, P.M. Clifton, J.B. Keogh. The effects of intermittent compared to continuous energy restriction on glycaemic control in type 2 diabetes; a pragmatic pilot trial. Diabetes research and clinical practice 122 ( 2016 ) 106-112.
  20. 20. Sharayah Carter, Peter M. Clifton, Jennifer B. Keogh. Effect of Intermittent Compared With Continuous Energy Restricted Diet on Glycemic Control in Patients With Type 2 Diabetes A Randomized Noninferiority Trial. JAMA Network Open. 2018;1(3):e180756. DOI:10.1001/jamanetworkopen.2018.0756
  21. 21. Rachel Leah Taft. Intermittent Fasting for Weight Loss: Pros and Cons for People with Diabetes. AADE in Practice. 2019. Volume: 7 issue: 4, page(s): 42-46
  22. 22. Corey A. Rynders, Elizabeth A. Thomas, Adnin Zaman, Zhaoxing Pan, Victoria A. Catenacci and Edward L. Melanson. Effectiveness of Intermittent Fasting and Time-Restricted Feeding Compared to Continuous Energy Restriction for Weight Loss. Nutrients. 2019. 14;11(10):2442. DOI: 10.3390/nu11102442
  23. 23. Victoria A. Catenacci, Zhaoxing Pan, Danielle Ostendorf, Sarah Brannon, Wendolyn S. Gozansky, Mark P. Mattson, Bronwen Martin, Paul S. MacLean, Edward L. Melanson, and William Troy Donahoo. A Randomized Pilot Study Comparing Zero-Calorie Alternate-Day Fasting to Daily Caloric Restriction in Adults with Obesity. Obesity (2016) 24, 1874-1883. DOI:10.1002/oby.21581
  24. 24. Samira Eshghinia, Michael Gadgevich Gapparov. Effect of Short-Term Modified Alternate-Day Fasting on the Lipid Metabolism in Obese Women. IRANIAN JOURNAL OF DIABETES AND OBESITY, VOLUME 3, NUMBER 1, SPRING 2011
  25. 25. Michelle Louise Headland, Peter Marshall Clifton, Jennifer Beatrice Keogh. Effect of intermittent compared to continuous energy restriction on weight loss and weight maintenance after 12 months in healthy overweight or obese adults. International Journal of Obesity (2019) 43:2028-2036.
  26. 26. Amy T. Hutchison, Bo Liu, Rachel E. Wood, Andrew D. Vincent, Campbell H. Thompson, Nathan J. O’Callaghan, Gary A. Wittert, and Leonie K. Heilbronn. Effects of Intermittent Versus Continuous Energy Intakes on Insulin Sensitivity and Metabolic Risk in Women with Overweight. Obesity (2019) 27, 50-58. DOI:10.1002/oby.22345
  27. 27. Hana Kahleova, Lenka Belinova, Hana Malinska, Olena Oliyarnyk, Jaroslava Trnovska, Vojtech Skop, Ludmila Kazdova, Monika Dezortova, Milan Hajek, Andrea Tura, Martin Hill and Terezie Pelikanova. Eating two larger meals a day (breakfast and lunch) is more effective than six smaller meals in a reduced-energy regimen for patients with type 2 diabetes: a randomised crossover study. Diabetologia (2014) 57:1552-1560. DOI 10.1007/s00125-014-3253-5
  28. 28. Cynthia M Kroeger, John F Trepanowski, Monica C Klempel, Adrienne Barnosky, Surabhi Bhutani, Kelsey Gabel, Krista A Varady. Eating behavior traits of successful weight losers during 12 months of alternate-day fasting: An exploratory analysis of a randomized controlled trial. Nutr Health. 2018 March ; 24(1): 5-10. DOI:10.1177/0260106017753487
  29. 29. Iolanda Cioffi, Andrea Evangelista, Valentina Ponzo, Giovannino Ciccone, Laura Soldati, Lidia Santarpia, Franco Contaldo, Fabrizio Pasanisi, Ezio Ghigo and Simona Bo. Intermittent versus continuous energy restriction on weight loss and cardiometabolic outcomes: a systematic review and meta-analysis of randomized controlled trials. J Transl Med. 2018 Dec 24;16(1):371. DOI: 10.1186/s12967-018-1748-4
  30. 30. Stephanie Welton, Robert Minty, Teresa O’Driscoll, Hannah Willms Denise Poirier, Sharen Madden and Len Kelly. Intermittent fasting and weight loss. Canadian Family Physician Vol 66. 2020
  31. 31. Patterson and Sears. Metabolic Effects of Intermittent Fasting. Annu Rev Nutr. 2017 Aug 21;37:371-393. DOI: 10.1146/annurev-nutr-071816-064634
  32. 32. Bartosz Malinowski, Klaudia Zalewska, Anna Węsierska, Maya M. Sokołowska, Maciej Socha, Grzegorz Liczner, Katarzyna Pawlak-Osińska and Michał Wiciński. Intermittent Fasting in Cardiovascular Disorders-An Overview. Nutrients. 2019 Mar 20;11(3):673. DOI: 10.3390/nu11030673
  33. 33. Kavitha Ganesan, Yacob Habboush and Senan Sultan. Intermittent Fasting: The Choice for a Healthier Lifestyle. Cureus. 2018 Jul 9;10(7):e2947. DOI: 10.7759/cureus.2947
  34. 34. Adrienne R Barnosky, Kristin K Hoddy, Terry G Unterman and Krista A Varady. Intermittent fasting vs daily calorie restriction for type 2 diabetes prevention: a review of human findings. Transl Res. 2014 Oct;164(4):302-11. DOI: 10.1016/j.trsl.2014.05.013
  35. 35. Stephen D. Anton, Keelin Moehl, William T. Donahoo, Krisztina Marosi, Stephanie A. Lee, Arch G. Mainous, Christiaan Leeuwenburgh, and Mark P. Mattson. Flipping the Metabolic Switch: Understanding and Applying the Health Benefits of Fasting. Obesity. 2017. DOI:10.1002/oby.22065
  36. 36. Shula Shazman. A Machine Learning Approach to Select the Type of Intermittent Fasting in Order to Improve Health by Effects on Type 2 Diabetes. Conference: 11th International Conference on Bioinformatics Models, Methods and Algorithms. Bioinformatics 2020. DOI: 10.5220/0008950201310137
  37. 37. International Diabetes Federation 2017. Diabetes Atlas 8th edition
  38. 38. McCulloch DK, Nathan DM, Wolfsdorf JI, Mulder JE, eds. Estimation of blood glucose control in diabetes mellitus. Wolters Kluwer Health. Accessed at: 2013. -- 2. A1C test and diabetes. National Diabetes Information Clearinghouse (NDIC). Available at: Accessed 011414. -- 3. American Diabetes Association. Standards of Medical Care in Diabetes—2014. Diabetes Care 2014;37:S14-S80
  39. 39. Levy J. C, Matthews D. R, Hermans M.P. Correct homeostasis model assessment (HOMA) evaluation uses the computer program. Diabetes Care 1998; 21: 2191-92. DOI: 10.2337/diacare.21.12.2191
  40. 40. HOMA2 Calculator. Oxford University. Available at:
  41. 41. Heilbronn L.K, Smith S.R, Martin C.K, Anton S.D. and Ravussin E. Alternate-day fasting in nonobese subjects: effects on body weight, body composition, and energy metabolism. Am. J. Clin. Nutr. 81 (1) (2005) 69-73. DOI: 10.1093/ajcn/81.1.69
  42. 42. Harvie M.N, Pegington M, Mattson M.P, Frystyk J, Dillon B, Evans G, Cuzick J, Jebb S.A, Martin B, Cutler R.G, Son T.G, Maudsley S, Carlson O.D, Egan J.M, Flyvbjerg A. and Howell A. The effects of intermittent or continuous energy restriction on weight loss and metabolic disease risk markers: a randomized trial in young overweight women. International Journal of Obesity (2011) 35, 714-727. DOI: 10.1038/ijo.2010.171
  43. 43. Schofield W.N. Predicting basal metabolic rate, new standards and review of previous work. Hum Nutr Clin Nutr 1985; 39 (Suppl 1): 5-41
  44. 44. Shai I, Schwarzfuchs D, Henkin Y, Shahar DR, Witkow S, Greenberg I et al. Weight loss with a low-carbohydrate, Mediterranean, or low-fat diet. N Engl J Med 2008; 359: 229-241. DOI: 10.1056/NEJMoa0708681
  45. 45. Chowdhury E.A, Richardson J.D, Holman G.D, Tsintzas K, Thompson D. and Betts J.A. The causal role of breakfast in energy balance and health: a randomized controlled trial in obese adults. Am J Clin Nutr. 2016 Mar;103(3):747-56. DOI: 10.3945/ajcn.115.122044
  46. 46. Halberg N, Morten H, Nathalie S, Bente S, Thorkil P, Peter S and Flemming D. Effect of intermittent fasting and refeeding on insulin action in healthy men. J Appl Physiol 99: 2128-2136, 2005. DOI:10.1152/japplphysiol.00683
  47. 47. Harvie M, Wright C, Pegington M, McMullan D, Mitchell E, Martin B, Cutler R.G, Evans G, Whiteside S, Maudsley S, Camandola S, Wang R, Carlson O.D, Egan J.M, Mattson M.P. and Howell A. The effect of intermittent energy and carbohydrate restriction v. daily energy restriction on weight loss and metabolic disease risk markers in overweight women. British Journal of Nutrition (2013), 110, 1534-1547. DOI:10.1017/S0007114513000792
  48. 48. Clifton P. M., Noakes M. and Keogh J. B. 2004. Very Low-Fat (12%) and High Monounsaturated Fat (35%) Diets Do Not Differentially Affect Abdominal Fat Loss in Overweight, Nondiabetic Women. Very Low-Fat (12%) and High Monounsaturated Fat (35%) Diets Do Not Differentially Affect Abdominal Fat Loss in Overweight, Nondiabetic Women. J Nutr. 2004 Jul;134(7):1741-5. DOI: 10.1093/jn/134.7.1741
  49. 49. IDF Diabetes Care. Volume 42, Supplement 1, January 2019
  50. 50. Sewaiwar P. and Verma K.K. Comparative Study of Various Decision Tree Classification Algorithm Using WEKA. International Journal of Emerging Research in Management &Technology 2015. ISSN: 2278-9359 (Volume- 4, Issue-10)
  51. 51. Hua J., Xiong Z., Lowey J., Suh E. and Dougherty E. R. Optimal number of features as a function of sample size for various classification rules. Bioinformatics. 2004. 21(8):1509-15. DOI: 10.1093/bioinformatics/bti171

Written By

Shula Shazman

Submitted: 02 June 2020 Reviewed: 02 December 2020 Published: 03 January 2021