**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


**395**

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

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

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

*DOI: http://dx.doi.org/10.5772/intechopen.95336*

individual found in the 10th excluded group.

**5.1 Prediction whether HOMA-IR decreases**

**5. Decision rules for health benefit due to intermittent fasting**

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

this study.

**4.4 Training and testing**

**Table 2.** *IF regimens.* *Selecting Intermittent Fasting Type to Improve Health in Type 2 Diabetes: A Machine Learning… DOI: http://dx.doi.org/10.5772/intechopen.95336*

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**

*Type 2 Diabetes - From Pathophysiology to Cyber Systems*

description are found in **Table 2** below.

**4.3 Building a model from the data**

**Intervention name**

*4.2.4 Individual's features*

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

ence to each regimen is also shown in **Table 2** for further details.

**Table 2** summarizes the different IF regimens included in this study. The refer-

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 fast-

ing insulin, intervention's name, intervention's and HOMA-IR difference.

**Details CER\**

DMF Daily Morning Fasting IER 4 weeks [45] FESD Fasting Every Second IER 2 weeks [46]

DER Daily Energy Restriction CER 24 weeks [47] High Carb High Carbohydrate weight loss diet CER 12 weeks [48] High Mono High Monounsaturated weight loss diet CER 12 weeks [48]

CER Continuous energy restriction - 7 days a

IER Intermittent energy restriction - 2 days a

IECR Intermittent Energy and Carbohydrate Restriction

IECR+PF Intermittent Energy and Carbohydrate

Restriction + free protein and fat

week trail

week trail

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

**IER**

**Duration Reference**

CER 24 weeks [42]

IER 24 weeks [42]

IER 24 weeks [47]

IER 24 weeks [47]

**394**

**Table 2.** *IF regimens.*

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.
