Using machine learning method for classification body mass index of people for clinical decision

Introduction: Body mass index (BMI) is an acceptable method to measure overweight and obesity among the population. Objectives: The aim of this study was evaluating the application of machine learning algorithms for classifying body mass index for clinical purposes. Patients and Methods: In this descriptive study, we selected the dataset of 1316 people who selected randomly from all area of Ardabil city in Iran. Dataset included demographic and anthropometric data. Classification algorithms such as random forest (RF), Gaussian Naive Bayes (GNB), decision tree (DT), support vector machines (SVM), multi-layer perceptron (MLP), K-nearest neighbors (KNN) and logistic regression (LR) with 10-fold cross-validation were conducted to classify the data based on BMI. The performance of algorithms was evaluated with precision, recall, mean squared errors (MSE) and accuracy indices. All programing done by Python 3.7 in Jupyter Notebook. Results: According to the BMI, 603(45.8%) of all samples were normal and 713 (54.2%) were at-risk. The precision of RF, GNB, DT, SVM, MLP, KNN and LR for people at risk were 0.93, 0.86, 0.99, 0.82, 100, 0.82 and 0.99 respectively. Additionally, the accuracy of RF, GNB, DT, SVM, MLP, KNN and LR were 95%, 83%, 100%, 82%, 100%, 82% and 100 %. Conclusion: The comparison of the classifying algorithms showed that, the LR, MLP and DT had the higher accuracy than the other algorithms in detecting of people at-risk.


Introduction
Obesity and overweight are complex, multifactorial and major public health problems world-wide which could affect people in all age groups and increase the risk of several diseases among people (1,2).Body mass index (BMI) is defined as a person's weight in kilograms divided by the square of his height in meters (kg/m 2 ).This index is conducted to measure obesity and overweight and to detect people at risk of obesity and overweight (3).According to the WHO reports, BMI less than 25 kg/m 2 is considered normal, and more than 25 kg/m 2 is at-risk of overweight and obesity.
The population with obesity and being overweight are increasing in the developed and developing countries, in a remarkable momentum, and it is estimated that by 2030 due to several factors, up to 57.8% of the world's elderly people would suffer from being overweight or obese (5,6).

Objectives
The aim of this study was to investigate the validity and accuracy of classifying the BMI by using various machine learning algorithms.

Data collection method and dataset
Our dataset is from the data that was used in an obesity and overweight research which had been conducted by Ardabil University of Medical Science.Part of the data was published in a paper by Amani et al (7).The used dataset included the BMI of 1316 people of Ardabil city in the year 2019.A detailed clarification of this dataset is given in Table 1.

Machine learning strategies
For this study we used seven classification machine learning algorithms included; Random Forest (RF), Gaussian Naive Bayes (GNB) classifier, Decision Tree (DT), support vector machine (SVM), Multi-layer Perceptron (MLP), K-nearest neighbors (KNN) and Logistic Regression (LR).We applied 10-fold cross-validation and holdout to trained and evaluated training datasets.

Implication for health policy/practice/research/ medical education
In this study, we evaluated the accuracy of applying machinelearning methods in classification of BMI which can be conducted for clinical decision makings.
regression and classification problems which assigns observations to a discrete set of classes.
Gaussian naive bayes classifier is a group of simple classifiers based on probabilities created assuming the independence of random variables and is based on Bayes theorem.
Decision tree: A DT is a map of possible results of a series of related choices or options therefore it allows an individual or organization to weigh possible actions in terms of costs, opportunities and benefits.
Support vector machine is classified as a pattern recognition algorithm.The SVM algorithm can be used wherever there is a need to identify patterns or classify objects in specific classes.
Multi-layer perceptron: the artificial neural network creates a structure similar to the biological structure of the human brain and neural network to be able to learn how to generalize and make decision.
Random forest is a combined learning method for regression classification, which works on the training time and class output (classification) or predicting each tree separately, based on a structure consisting of a large number of DTs.
K-nearest neighbors: In statistics, the KNN algorithm is a non-parametric classification method first developed by Evelyn Fix and Joseph Hodges in 1951, and later expanded by Thomas Cover.It is used for classification and regression.

Data preprocessing
Data preprocessing is necessary to prepare the BMI data in a manner that a machine learning model can accept, so the dataset was divided into two training and test data categories.Separating the training and the testing datasets ensures that the model learns only from the training data, and tests its performance with the testing data.The training data contain 80% of the total dataset and the test and validation data contain 20% each with 10-fold -validation.

Machine learning model selection
Seven classification algorithms such as RF, GNB, DT, SVM, MLP, KNN and LR were applied and used to train and evaluate training datasets.

Variable selection
Feature selection strategy for classification model was selecting a minimally sized subset according to the following criteria: (a) Increasing the classification accuracy and (b) The values for the selected features should be as close as possible to the original class distribution.All features are listed in Table 2.The response variable in dataset of our study was BMI of patients which was defined as a person's weight in kilograms divided by the square of his height in meters (kg/m 2 ) and divided into two classes; Normal (18.5 ≤BMI <25) and at-risk (25 ≤BMI).

Model assessment
The confusion matrix which included TP, FP, FN and TN was used to determine the relationship between actual values and predicted values.Table 3 shows the structure of confusion matrix.
We compared the classification performance of all ML algorithms by using accuracy, precision, recall (sensitivity), F1-score and mean squared errors (MSE) indices.
True positives (TP) and true negatives (TN)] represent the number of true positive or true negative samples.Accuracy is a statistical measure which is defined as the quotient of correct predictions (both TP and TN) made by a classifier divided by the sum of all predictions made by the positive cases, i.e. the correctly and the incorrectly cases predicted as positive.

TP TN Accuracy
TP TN FP FN Precision is the ratio of the correctly identified positive cases to all the predicted positives.

Precision = TP TP FP +
Recall, also known as sensitivity, is the ratio of the correctly identified positive cases to all the actual positive cases, which is the sum of the "false negatives" and "true classifier, including false positives (FP) and false negatives (FN).Also, F1-score index is calculated as the following: Precision*Recall F1-score=2* Precision+Recall

Statistical analysis
In this dataset, we used the descriptive statistical method in SPSS version 21.Additionally, we used Python 3.7 and Jupyter Notebook and skit-learn commands for programing and then conducting the ML algorithms.

Patient's characteristics
Of all the studied population, 686 (52.1%) were men and 630 (47.9%) were women.The mean age of the participants was 28.5±7.4 years old (range 20 to 49).All of the participants were from urban community of Ardabil city (Table 4).

Performance of the machine learning algorithms
In these ML models, we predicted the whole dataset using 10-fold cross-validation and evaluated the performance on classifying the BMI by measuring accuracy, precision (positive predictive value), recall (sensitivity) and F1score indices.Figure 1 shows the performance of the predictive model using different data mining algorithm techniques.As shown in Figure 1, the LR and MLP with 100% and RF with 97% had the highest sensitivity than other algorithms.In addition, the algorithms DT, LR and MLP with 100% had the highest accuracy rate than others in the classification of people based on BMI data.

Discussion
The main goal of this study was evaluating the efficacy of ML algorithms and techniques in BMI data, which we used various machine learning (ML) algorithms to improve the classification of at-risk people based on BMI data which could be provided significant insights compared with traditional statistical models.Among all ML models, DT, LR and MLP showed higher performance than the others.Similar to this study, Wu et al in a study on fatty liver disease using machine learning algorithms showed that among studied algorithms, the RF model showed higher performance than other  classification models; however had some difference with our study results (8).
To our knowledge, this is the first population-based study used various machine learning algorithms to detect at-risk people based on BMI data.There are many kind of machine learning algorithms have been developed, and along with the most popular Bayesian algorithm, and LR, it is hard to make a proper algorithm for clinical decision makings and clinical practices (9).Therefore, along with the easiness in application, the performances of different algorithms should be considered.Our model could effectively detect at-risk people based on BMI data without using advanced methods (10).
The increasing health issues related to obesity and overweight make a remarkable need of data gathering and risk predicting based on the BMI (11).Therefore, it is an opportunity to apply machine learning algorithms to classify individual patients in medical practice, treat them, and control their future possible consequences.Using various machine learning prediction models, let the physicians and the health staff be able to extract the minimum necessary data to make a precise decision about people with normal and non-normal BMI (12).
Lee et al in a previous study showed that accuracy percentage of ML method ranged from 60.4% to 73.8%, which was lower than our results; in our study the accuracy percentage ranged from 82% to 100% (13).
Uddin et al in a study comparing different supervised machine learning algorithms for disease prediction, showed that among of all the ML algorithms, the algorithm RF had the highest accuracy comparing with other algorithms.However, their study was not in line with our study results because in our study we found that the best accuracy is related to the other algorithms such as DT, LR and MLP each with 100% accuracy (14).
Accordingly, Ilyas et al, showed that machine learning techniques can be effective in the diagnosis of kidney disease.Of all used machine learning algorithms, the most accuracy among all ML algorithms was related to the SVMs algorithm with 0.97.In our study the accuracy of SVMs algorithm among all of the applied ML algorithms was 0.82 which was lower than the study by Ilyas et al rate (15).

Conclusion
In this study, seven machine learning techniques were used to classify healthy people from at-risk people based on BMI data.All the algorithms worked with a reasonable accuracy and speed.However, the DT, LR and MLP algorithms showed maximum precision and minimum errors among all algorithms and also, these algorithms showed better performance than other ML classification techniques.This prediction outcome has the potency to help clinicians and health system staff to make more precise and meaningful decisions about people at-risk of overweight and obesity to provide a plan for decreasing their risk of diseases and change their bad life style in comparison with healthy people.

Limitations of the study
We have not any limitation in this study.

Figure 1 .
Figure 1.Comparison performance of different machine learning algorithms on classification of people based on BMI data by holdout and 10-cross validation method.Note: RF = Random forest, SVM = Support vector machine, MLP = Multi-layer perceptron, KNN = K-nearest neighbors , LR= Logistic regression, DT = Decision tree classifier, GNB = Gaussian Naive Bayes.

Table 1 .
Description of the BMI datasets

Table 2 .
Features of obesity type dataset

Table 3 .
Structure of confusion matrix

Table 4 .
Demographic characteristics of the participants (n=1316)