# PISIoT: A Machine Learning and IoT-Based Smart Health Platform for Overweight and Obesity Control
## Materials and Methods
### Methodology  
This case study was conducted to monitor 40 obese elderly people from 60 to 80 years old (20 female and 20 male) who showed symptoms associated with myocardial infarction (e.g., pain in the center of the chest, difficulty breathing, numbness or pain in the right arm, sweating, paleness, dizziness) or had already experienced a myocardial infarction, and who needed to lose weight. A wearable device was assigned to each patient to obtain the biomedical variables (heart rate, sleep, calories burned, weight, and minutes of physical activity) and other variables (steps, floors, calories consumed, distance traveled, water consumed, and exercise). In addition, a smart scale was assigned to each patient to periodically record weight. For the purposes of this case study, it was necessary to obtain information about eating habits, water consumption, minutes of activity, calories burned, sleep, number of steps per day, and heart rate, both before and after implementation of PISIoT. For this reason, we followed the methodology described below:  
* Initial monitoring was performed over a period of two months (August--September 2018) using the wearable device; at the end of that period, weight was obtained with the smart scale. Both devices were linked to a smartphone to send the data to the device provider. A relative of the patient recorded food and water consumption using the platform for the wearable device. During this period, only the mobile application for the wearable device and smart scale were used. These focused only on monitoring the patient's biomedical variables and did not provide any type of alert or medical recommendation to lose weight. * Implementation of PISIoT. Afterwards, a second monitoring period ran for four months (October 2018--January 2019); the biomedical variables of the elderly people were requested from the device providers. Subsequently, the elderly patients' BMI was calculated using the formula BMI = weight (kg) \(\div\) height2 (m) [1,61]. Then, the patients were classified to predict obesity with the classes ClsModel.java, ClsAlgorithms.java, ClsInstanceWeka.java, and InstanceAlgorithm.java using the machine learning algorithm J48. Table 1 shows the classification used to determine the type of obesity according to the World Health Organization (WHO) [61]. In addition, the patient's biomedical variables (heart rate, calories burned, sleep, minutes of physical activity, and weight) and other variables (steps, floors, calories consumed, distance traveled, water consumed, and exercise) were considered in the classification to describe the behavior of elderly patients with obesity. With the data obtained by the wearable device and smart scale, a dataset was created with 17 predictor attributes (calories consumed, calories burned, carbohydrates, fat, proteins, water consumed, exercise duration, heart rate during exercise, resting heart rate, minutes of physical activity at peak level, minutes at cardio level, minutes at fat burning level, steps, floors, distance traveled, sleep duration, and weight), one class label attribute (obesity), and 7200 instances; daily data were registered for each patient and classified as the type of obesity that patients will exhibit, according to the values of the predictor attributes, if they maintain this behavior. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Classification** & **Minimum Value** & **Maximum Value** \\ \hline Normal & 18.50 & 24.99 \\ Overweight & 25.00 & 29.99 \\ Obesity 1 & 30.00 & 34.99 \\ Obesity 2 & 35.00 & 39.99 \\ Obesity 3 & 40.00 & + \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Ranking rule according to BMI. * This made it possible to perform an analysis to identify possible critical variables that influence the emergence of obesity in elderly people, generate recommendations, and propose the IoT-based medical services that patients require to lose weight. The J48 algorithm has been adopted in PISIoT using the data set to obtain the predictive model with the 10-fold cross-validation technique.