IoMT Meets Machine Learning: From Edge to Cloud Chronic Diseases Diagnosis System

In conventional healthcare, real-time monitoring of patient records and information mining for timely diagnosis of chronic diseases under certain health conditions is a crucial process. Chronic diseases, if not diagnosed in time, may result in patients' death. In modern medical and healthcare systems, Internet of Things (IoT) driven ecosystems use autonomous sensors to sense and track patients' medical conditions and suggest appropriate actions. In this paper, a novel IoT and machine learning (ML)-based hybrid approach is proposed that considers multiple perspectives for early detection and monitoring of 6 different chronic diseases such as COVID-19, pneumonia, diabetes, heart disease, brain tumor, and Alzheimer's. The results from multiple ML models are compared for accuracy, precision, recall, F1 score, and area under the curve (AUC) as a performance measure. The proposed approach is validated in the cloud-based environment using benchmark and real-world datasets. The statistical analyses on the datasets using ANOVA tests show that the accuracy results of different classifiers are significantly different. This will help the healthcare sector and doctors in the early diagnosis of chronic diseases.


Introduction
Healthcare has an undeniable impact on the well-being of individuals [1,2]. Chronic diseases adversely afect the health of human beings. Tis requires an early and accurate diagnosis which is possible after a physical examination in the hospital. Te delayed diagnosis requires patients' admission to the hospital for treatment which results in increased healthcare cost and duration, and restricted healthcare facilities in rural and remote areas [3]. Te traditional diagnosis approaches are human-centered and error-prone, e.g., missed or delayed diagnosis, failure to initiate the follow-up, inaccessible patients' history, wrong medical prescription, and incomplete information about patient history which may lead to severe consequences to patients' health [4]. Tese challenges require the healthcare domain to adopt the latest technological disruptions in the felds of IoT, artifcial intelligence (AI), and ML to reduce human error.
Te IoT has demonstrated its benefts in connecting medical devices, sensors, and healthcare professionals to provide quality medical services [5] which resulted in extended healthcare services and reduced costs. Te medical history of patients collected through these IoT devices also helps in the efective monitoring of patients' health and early diagnosis by healthcare service providers. Tese benefts have resulted in the transformation of present healthcare facilities from hospital-centric facilities to patient-centric facilities [6,7]. Te network of medical devices and healthcare professionals created through sensors is also referred to as the Internet of Medical Tings (IoMT) which in a healthcare system is called healthcare Internet of Tings (HIoT) [8].
Te IoMT has revolutionized the healthcare industry and demonstrates efective healthcare and monitoring system. Tis connects device to machine, doctor to doctor, patient to doctor, object to object, patient to machine, doctor to machine, sensors o mobile, and mobile to human in an intelligent way [4]. Te efective usage of IoT devices data is critical and key to success. In this context, ML has proved to be one of the most suitable computational paradigm which ofers embedded intelligence in the IoT devices [9] for predictive and prescriptive diagnosis in healthcare.
Te existing systems are mostly limited to the prediction of one chronic disease considering no computing layer. To overcome such issues, an ML-based predictive model is presented to improve the diagnosis of six diferent chronic diseases based on the conceptual framework of 3 diferent computing layers, i.e., edge computing, fog computing, and cloud computing. Te IoT devices (smart devices) data are used for diagnosis using 3 diferent computing techniques with the following contributions: (i) New system design: a novel system architecture is designed using IoMT and ML, based on a conceptual framework of 3 diferent computing layers, for accurate and quick diagnosis of 6 diferent chronic diseases (ii) State-of-the-art algorithms comparative study: different ML-based states of the art algorithms are compared for chronic diseases diagnosis (iii) Data set: the proposed approach is tested on both real-world and benchmark data instances from Kaggle [10] Tis paper is structured into six sections. Section 2 presents the background and related work whereas the proposed methodology is explained in Section 3. Te experimental design and analysis results are presented in Section 4. Te threats and validity of this study are presented in Section 5. Te paper concludes with Section 6 where results and future directions are presented.

Background.
Te healthcare industry is rapidly adopting the IoT by integrating technology into medical devices to enhance the quality and efciency of service [11]. On the other hand, the advancement in machine learning has infuenced researchers to predict chronic diseases with high accuracy. Tis ML-based IoMT framework is playing a signifcant role in the healthcare industry by reducing the mortality rate by the early detection of diseases [12]. Existing studies analyze mostly one chronic disease [11,[13][14][15][16][17]. However, there are many other chronic diseases exist, e.g., pneumonia, COVID-19. In this regard, we investigate the performance of state-of-the-art algorithms to diagnose chronic diseases. Te reason for selecting these algorithms is that they are simple to implement and most of them are open source.
Te convolution neural network (CNN) [18] is a dominant ML approach for image recognition, image classifcation, and object detection. It is a highperformance classifer that automatically detects the important features and is computationally efcient. Te basic structure of CNN is given in Figure 1. Te VGG16 [19] is based on a CNN architecture that is used for object detection and classifcation. It utilizes 16 layers with weights and is considered one of the best image classifcation algorithms. However, it is very slow to train. Te VGG19 [19] is also a CNN that is based on 19 deep layers. Te frst 16 convolutional layers are used for feature extraction, and the rest 3 layers for classifcation. It is trained on more than a million images from the ImageNet database and can classify images into 1000 object categories. It is a very popular method due to the use of multiple 3 × 3 flters in each convolutional layer.
Residual network (ResNet) [20] is one of the most powerful deep neural networks which have achieved excellent performance to solve classifcation problems. It is based on CNN architecture to support hundreds or thousands of convolutional layers. DenseNet [21] is also a CNN-based architecture that utilizes dense connections among layers through dense blocks. It makes direct connections between any two layers with the same feature-map size. It has proved to yield consistent improvement in accuracy without any signs of performance degradation or overftting. Te Inception-v3 [22] is a pretrained model on the ImageNet datasets. It performs better for image classifcation problems as compared to other deep learning algorithms. XGBoost [23] is a decision tree-based ML algorithm that combines the results of many models, called base learners to make a prediction. It is a sequential model where each subsequent tree is dependent on the outcome of the last. It is a highly fexible technique and handles missing values automatically.
Decision tree (DT) [24] is a most popular nonparametric supervised learning algorithm that is used for classifcation and prediction. Tey support scalability for large datasets, handle imbalanced datasets, and easy to use. However, they can be computationally expensive to train and sufer from high variance. To overcome the issue of high variance, we apply bagging. In bagging, bootstrap samples are created from the training data set, and then, trees are built on bootstrap samples. After that, the output is aggregated from all the trees to predict the fnal output [25]. Random forest (RF) [26] is a widely used ML algorithm due to its ease of use and fexibility. It handles both classifcation and regression problems and combines the output of multiple decision trees to reach a single result. It also ofers feature selection to quickly understand the important or nonimportant features that are afecting the fnal result.

Related Works.
Wearable/smart IoT devices are used in healthcare for real-time monitoring of patients' health. Te ML models developed based on the data collected from these IoTdevices have been successful in accurately diagnosing the diseases. In this section, a literature review of recent IoTdriven ML model-based approaches is presented. Khelili et al. [27] proposed an IoMT CNN-based model to detect COVID-19 cases from pneumonia and normal cases with 97% accuracy. Rani et al. [28] presented an IoMT with ML-based COVID-19 diagnosis model. Tey used AdaBoost with random forest (AB-RF), artifcial neural network (ANN), support vector machine (SVM), and DT as classifers. Parthasarathy and Vivekanandan [14] developed a diagnosis model for arthritis disease. In this model, data were collected from sensors and stored on cloud whereas an optimization algorithm considers swelling and uric acid as key predictors. Bhuvaneswari and Manikandan [15] proposed a novel framework based on ML for type-2 diabetes analysis.
Rohani et al. [29] developed a brain-computer interface (BCI) system for the rehabilitation of attention defcit hyperactive disorder in children. Tey applied SVM [30] using temporal and template-based features for disorder diagnosis. Monteiro et al. [31] proposed a system based on ML techniques to predict Ischemic stroke. Palani and Venkatalakshmi [32] proposed an IoT-based predictive model using fuzzy cluster to predict lung cancer through continuous monitoring. Te proposed system also improved healthcare delivery through real-time medical instructions. Sciarrone [33] developed a reliable wearable and noninvasive device to detect Alzheimer's and Parkinson's disease.
Kumar and Devi Gandhi [13] presented an IoT architecture employing ML algorithms for the early detection of heart diseases. Te proposed architecture comprises data collected from wearable smart devices with storage on the cloud and prediction using the regression-based local model. Alamelu and Tilagamani [16] developed a lion-based butterfy optimization algorithm with an improved YOLO-4 model to predict heart disease. Prakash and Karthikeyan [17] also proposed a dual-layer deep ensembling technique to classify the heart disease by outperforming traditional state-of-the-art classifers. Khan [11] presented a modifed deep convolutional neural network to diagnose the heart disease. As an improvement of their work [12] to predict the heart disease, they also proposed an optimized algorithm in an IoMT cloud environment.
Ogundokun et al. [34] proposed an hybrid technique based on Inception-v3 and SVM to detect the human posture in health monitoring systems. Te same efort [35] has been made to identify the human activity using the IoMT approach to avoid fall detection, smoking control, sportive exercises, and monitoring of daily life activities. Ogundokun et al. [36] developed a hyperparameter-optimized neural network technique to diagnose the breast cancer.
Kim and Chung [37] proposed a model to keep track of chronic diseases as full recovery from such diseases is rare due to diverse causes and complexity. Farahani et al. [38] presented a comprehensive survey based on the multilayer architecture of IoT e-health that includes devices, fog, and cloud computing to enable the system to support latency, variety, and speed of data processing. Moreover, challenges such as scalability, data management, interoperability, privacy, and security are also considered for complex data processing in the IoT e-health environment. Pal et al. [39] proposed a novel method for real-time detection of anomalies in the patients' data. Te studies [40,41] proposed a secure framework to ensure the privacy of patients' data. Besides these, other studies [8,[42][43][44] provide a survey of research on the IoT in healthcare. All of these studies have also been summarized in Table 1.
Te above literature highlights that most of the studies focus on a single disease using cloud excluding many chronic diseases and computing layers. Human life is aficted by various diseases; therefore, this raises interest in research to consider chronic diseases.

Proposed Methodology
In this section, the proposed methodology for six chronic diseases is presented followed by the ML model ( Figure 2) and three diferent computing layers to detect these diseases.
Te proposed methodology is divided into three modules: (i) Data fetching (ii) Disease detection (iii) Computing layers 3.1. Data Fetching. In this module, data are fetched from diferent smart or wearable IoT devices, e.g., cameras and smart watches. Consequently, data are fed into the system.

Disease Detection.
Tis module is focused on developing the ML model. Te fetched data from the previous module are processed using diferent state-of-the-art ML algorithms for multichronic disease diagnosis. Te ML model uses images to diagnose COVID-19, brain tumor, pneumonia, and Alzheimer. Te workfow of the proposed methodology is presented in Figure 3. Te detailed steps for this process are explained as follows: (i) Data preprocessing: In this step, images are cropped and resized to obtain the region of interest (ROI).   [54] is applied for hyperparameter optimization because all prediction systems with efcient hyperparameter tuning achieve better results [55]. Te XGBoost algorithm [48] is used to train the model. It is a tree-based distributed ML classifcation algorithm used to improve the model's speed and performance up to 10 times in comparison to other classifcation algorithms [55]. In each iteration, Bayesian optimization tries to improve the AUC mean score. Te workfow of this proposed methodology is presented in Figure 4. In case of diabetics' disease diagnosis, the input to the system is in the form of numerical values. Te frst step is to standardize the data due to varying scale and division in 70% and 30% ratio as training and test dataset. Te visual representation of the proposed methodology is also shown in Figure 5.

Computing Layers.
Te computing module comprises of 3 layers architecture to deploy the ML algorithm on a server depending on the patient's crowd. We consider that if the number of patients is limited, our model is embedded in the Arduino module; otherwise, if the patients' count exceeds a certain threshold, we use edge computing for training our model. Moreover, for a huge count of patients, the classifer is placed in the cloud server.

Dataset.
In this paper, six datasets for six diferent chronic diseases are used ( Table 2). For COVID-19, diabetes, and heart diseases, the real-time dataset is used. However, to diagnose the brain tumor and pneumonia, the dataset is obtained both from Kaggle [10] and real data. Te open access series of imaging studies (OASIS) [56] and real datasets are used for Alzheimer's disease.

Performance Measures.
In this section, the quantitative metrics used to evaluate the performance of classifers are presented. As results are classifed as a positive class or negative class in the classifcation problems, therefore, there are four possible states also known as confusion matrix [59].  Te results' performance is evaluated using accuracy, precision, recall, and F1 score, which are calculated as follows:   precision.recall precision + recall . (5) Te AUC is also used as a performance metric. It is measured by plotting a ROC (receiver operating characteristic) curve of the true positive rate against the false positive rate at diferent classifcation thresholds. Te term "AUC � 1" indicates that the classifer is able to perfectly distinguish between all the positive and the negative classes correctly. If, however, the AUC is 0, then the classifer is predicting all negatives as positives, and vice versa.  Table 3, the hyperparameter settings used for COVID-19, pneumonia, brain tumor, and Alzheimer's diseases are presented whereas Table 4 presents the hyperparameter settings for heart disease diagnosis.

Experimental Environment.
All the experiments are run on GPU-enabled TensorFlow [60] with Keras [61] framework using Python programming language, running on a personal computer with Intel core i5, 3.2 GHz CPU, and 16 GB RAM.

Comparison of State-of-the-Art Methods.
In the proposed methodology, fve pretrained deep CNN models, VGG16, VGG19, ResNet, DenseNet, and Inception-v3, are used to detect COVID-19. Te results as presented in Table 5 show that the pretrained VGG16 model signifcantly outperforms the other four models with the highest classifcation performance as 80%.
After the VGG16 classifer, VGG19, DenseNet, and Inception-v3 resulted in an accuracy rate of 60%, whereas ResNet showed the lowest accuracy rate as 50%. Te visual representation of these values is also given in Figure 6. Te comparative analysis of four transfer learning models to detect pneumonia using chest X-ray images is presented in Table 6. Te results show that VGG19 outperforms its peers as it achieves the highest values for classifcation accuracy and F1 score as 88.46% and 91%, respectively. However, its recall is less than VGG16. Te ResNet and Inception-v3 are the least performing models in terms of accuracy, recall, and F1 score. Te visual representation of these results is presented in Figure 7. Table 7 presents the accuracy and loss values achieved by each model during training and validation. Te results also show that ResNet and Inception-v3 show substantial overftting as the diference between training and validation accuracy is signifcantly large. Tese two models have large validation loss, and their validation or classifcation accuracy is also low. Te graphical representation of model accuracy and model loss of ResNet and Inception-v3 is presented in Figures 8(a) and  8(b), respectively. It is evident that there is variation in training, validation accuracies, and loss as the epochs count increases.
For diabetics diagnosis, decision tree, bagging with a decision tree, random forest, and random forest with feature selection method are used. Te results show that the random forest with feature selection method demonstrates the highest accuracy measure of 92.02% (Figure 9) whereas the decision tree performed least with an accuracy rate of 75.2% (Table 8). Te accuracy is tested with various numbers of trees until the accuracy becomes stable and received a stable accuracy rate from 40 trees. For brain tumor diagnosis, CNN is used for faster and efcient processing. CNN has proven to give the better performance than traditional ones [62] with an accuracy rate of 91%. However, to detect the heart disease, the XGBoost classifer is applied with Bayesian optimization. We calculate the AUC to measure the performance of our model which resulted in 0.883 as shown in Figure 10. Tis shows the optimal performance of the model. Te confusion matrix is also shown in Figure 11 which shows that the trained classifer made predictions with high accuracy.
Te CNN model is used through 15 epochs for Alzheimer's disease. Te results show that we reached a general accuracy of 97%. Figure 12 presents how the training and         validation accuracy converges as the epochs progress.
Reasonably, there is a convergence towards a higher level of accuracy, the more epochs the model runs through. It can be observed that as the model reaches 10 epochs, we reach notable diminishing returns.

Statistical Analysis.
In this section, we perform the analysis of variance (ANOVA) test to analyze the statistical signifcance of the ML models. ANOVA is a statistical technique to analyze the diferences among group means by comparing the variance among groups relative to variance within groups [17]. Te p value in ANOVA test should be lower than 0.05 (5%) to reject the null hypothesis (H 0 ) which assumes in our study that the accuracy results of all classifers are equal.
Tus, this study simulates the diferent machine-learning methods on chronic disease datasets. Tis experiment primarily aims on building several machine learning classifers on diferent disease datasets and analyzing the accuracies among those classifers. Te accuracy performance of each classifer is compared statistically to determine that either classifer's accuracy is statistically signifcant from each other. In this experiment, we perform ANOVA test for COVID-19, pneumonia, and diabetes datasets as shown in Table 9.

Threats to Validity
Tis study aims to diagnose chronic diseases in a timely and cost-efective manner. However, there are few limitations to this work. First, the inclusion of more real-world scenarios   may improve diagnostic accuracy. Besides the fact that available datasets are limited, the inclusion of more realworld instances will improve the scalability and validation of the proposed approach. Tis will also add resilience to the proposed methodology by generating identical diagnosis as a medical doctor.

Conclusion
Internet has a major impact on our lives, spanning from professional life to social relationships. Te IoT has added a new dimension to this process by establishing communication among smart objects, leading to the vision of anytime, anywhere, any media, and anything communication. IoMT is a specialized version of IoT, which specifcally deals with the healthcare domain and is playing a vital role in the healthcare sector to provide cost-efective solutions in terms of hospital billing and waiting time. In this paper, a new approach is presented to diagnose 6 diferent chronic diseases, namely, COVID-19, diabetes, pneumonia, Alzheimer, heart disease, and brain tumor, using machine learning classifers based on 3 computing layers. Te proposed approach is evaluated for each disease using diferent classifers using both benchmark and real-world datasets.
Tis also provides efcient and efective health services to the patients by disseminating the networked information to machine learning classifers. In the future, the proposed approach will be evaluated with more real-world datasets while considering more chronic diseases. Moreover, eforts will be made to develop cross-disciplinary chronic disease prediction models due to common feature sets.

Data Availability
Te data supporting the current study are available from the corresponding author upon request.