Predicting Abnormal Respiratory Patterns in Older Adults Using Supervised Machine Learning on Internet of Medical Things Respiratory Frequency Data

: Wearable Internet of Medical Things (IoMT) technology, designed for non-invasive respiratory monitoring, has demonstrated considerable promise in the early detection of severe diseases. This paper introduces the application of supervised machine learning techniques to predict respiratory abnormalities through frequency data analysis. The principal aim is to identify respiratory-related health risks in older adults using data collected from non-invasive wearable devices. This article presents the development, assessment, and comparison of three machine learning models, under-scoring their potential for accurately predicting respiratory-related health issues in older adults. The convergence of wearable IoMT technology and machine learning holds immense potential for proactive and personalized healthcare among older adults, ultimately enhancing their quality of life.


Introduction
In modern times, technology has become an integral part of our daily routine, with numerous initiatives aimed at improving our lives through tech-based solutions.This project explicitly targets individuals aged 60 and above who are vulnerable regarding health.Around 26.3% of this population lacks health insurance coverage and faces difficulties regarding companionship and care due to changing family dynamics [1].
The growing global population of senior citizens is a critical matter that demands our attention.In 1950, there were 200 million people aged 60 and above, but this number exceeded 350 million by 1975.According to recent projections, this figure is expected to double by 2025 [2].Older adults who have been inactive and confined to bed for extended periods may develop cardiovascular, respiratory, and musculoskeletal problems, exacerbating their illnesses [3].Furthermore, this age group tends to recover more slowly, with 33% experiencing difficulties performing one or more daily activities among those aged 60 to 79, increasing to 50% for those over 80 [3].
Respiratory infections affecting the lower tract are a severe health risk for older individuals worldwide.Two types of lower respiratory tract infections (LRTIs) that are of concern are chronic obstructive pulmonary disease (COPD) and pneumonia [4].With the past COVID-19 pandemic, these respiratory illnesses became the most fatal infectious diseases globally, with older adults being the most affected and requiring lengthy hospital stays [5][6][7].The health emergency has increased the pressure on hospitals and clinics, emphasizing the need to develop healthcare models that allow patients to receive treatment at home.These new healthcare models have enhanced the quality of life for older individuals, reduced medical costs, and lessened the stress of hospitalization or transfer [8].
Internet of Medical Things (IoMT) technology is a promising solution in the medical field.The IoMT connects various medical instruments, devices, or sensors to the internet, enabling real-time data collection on a user's physical condition and accurate diagnosis [9,10].Additionally, integrating machine learning (ML) algorithms into this system has been proposed.ML employs historical data to create computer programs capable of autonomously solving problems effectively [11], which becomes a critical component for early detection of abnormal respiratory patterns and health risk forecasting for older adults.
New non-invasive wearable technology for respiratory monitoring has produced encouraging clinical results in early disease detection.When used correctly, this technology could significantly reduce hospitalizations and mortality rates from severe respiratory ailments, enhancing the quality of life for those affected.
Our research aims to develop a machine learning model that can be integrated into IoMT systems for respiratory monitoring.It will help in predicting potential health risks in older adults.We have established specific goals to achieve this, such as exploring different respiratory monitoring sensors, creating non-invasive IoMT system prototypes, and training our machine learning model to identify abnormal breathing patterns accurately.This approach supports enhancing respiratory health monitoring in older adults by combining advanced technology with predictive analytics.

Related Works
Recent research has seen increased machine learning and deep learning techniques for respiratory monitoring and detecting abnormal breathing patterns.Argerich et al. [12] studied elderly patients to detect periodic breathing.The research found that the features extracted from breathing patterns and standard clinical variables are solid indicators for identifying periodic breathing events.
Furthermore, Farrukh et al. [13] contributed to the field with an innovative IoMTenabled smart healthcare model tailored to monitor the elderly population.By utilizing machine learning techniques on IoMT datasets, the study aimed to enhance healthcare monitoring for elderly individuals.Pham et al. [14] introduced a novel approach by merging deep learning frameworks to predict respiratory anomalies, including inception-based and transfer learning-based models.The results demonstrated that this ensemble approach outperformed existing state-of-the-art systems, promising advancements in respiratory anomaly detection.
Wang et al. [15] introduced an online measuring system to pursue unobtrusive and realtime classification of abnormal respiratory patterns.This system uses deep neural networks and depth cameras to automatically classify abnormal respiratory patterns, with potential for large-scale applications.The study examined respiratory patterns and the differences between COVID-19 and other respiratory illnesses like the flu and the common cold.
Jin et al. [16] conducted a study using the IoMT to predict outcomes for outpatients.The study found that a multi-dimensional prediction model performed better than other models in comparative experiments, indicating the potential of the IoMT in improving outpatient care.
These findings highlight the potential of supervised machine learning on the IoMT for predicting abnormal respiratory patterns in older adults.

Data Acquisition
Our study used four respiratory Internet of Medical Things (IoMT) prototypes to collect data.These systems were created to work with a machine learning model so that we could detect abnormal breathing patterns in older adults and anticipate any potential health problems.
We created three IoMT prototypes using an ESP8266 microcontroller and the Arduino development environment.Each prototype used different sensors and methods to collect data.We used a system-on-chip (SoC) sensor for the fourth prototype, eliminat-ing the need for an extra microcontroller.The prototypes were based on tutorials from BioMakers University [17].
The sensors in these systems can detect signals when a person breathes.These signals are analyzed to differentiate between breaths and other movements to determine the number of breaths per minute (RPM) by combining temporal data and sensor signals.The RPM data are then saved for future use in creating a dataset.
Next, the prototypes will be described.

Microphone Sensor Prototype
As part of our research, we developed a prototype that utilizes a Ky-037 microphone sensor, a NodeMCU ESP8266, and a 128 × 64 pixel OLED display.This device is designed to capture acoustic signals produced during the breathing cycle of our study participants, as shown in Figure 1.The microphone sensor is integrated into a facial mask to record changes in airflow and sound associated with inhalation and exhalation.The data collected from this prototype are vital in identifying abnormal breathing patterns in older adults.
could detect abnormal breathing patterns in older adults and anticipate any potential health problems.
We created three IoMT prototypes using an ESP8266 microcontroller and the Arduino development environment.Each prototype used different sensors and methods to collect data.We used a system-on-chip (SoC) sensor for the fourth prototype, eliminating the need for an extra microcontroller.The prototypes were based on tutorials from Bi-oMakers University [17].
The sensors in these systems can detect signals when a person breathes.These signals are analyzed to differentiate between breaths and other movements to determine the number of breaths per minute (RPM) by combining temporal data and sensor signals.The RPM data are then saved for future use in creating a dataset.
Next, the prototypes will be described.

Microphone Sensor Prototype
As part of our research, we developed a prototype that utilizes a Ky-037 microphone sensor, a NodeMCU ESP8266, and a 128 × 64 pixel OLED display.This device is designed to capture acoustic signals produced during the breathing cycle of our study participants, as shown in Figure 1.The microphone sensor is integrated into a facial mask to record changes in airflow and sound associated with inhalation and exhalation.The data collected from this prototype are vital in identifying abnormal breathing patterns in older adults.

Gas Sensor Prototype
As part of the study, another prototype that utilizes a gas sensor (Mq-3 model) and a NodeMCU ESP8266 was created.The gas sensor was integrated into participants' facial masks (see Figure 2) to monitor the chemical composition of the air they inhaled and exhaled.This prototype enabled researchers to gather essential data on the concentration of respiratory gases, which proved helpful in identifying abnormal breathing patterns in older adults.

Gas Sensor Prototype
As part of the study, another prototype that utilizes a gas sensor (Mq-3 model) and a NodeMCU ESP8266 was created.The gas sensor was integrated into participants' facial masks (see Figure 2) to monitor the chemical composition of the air they inhaled and exhaled.This prototype enabled researchers to gather essential data on the concentration of respiratory gases, which proved helpful in identifying abnormal breathing patterns in older adults.

Movement Sensor Prototype
For accurate measurement of chest movement during respiratory cycles, the third prototype included an accelerometer and gyroscope sensor integrated with an ESP8266 NodeMCU, as shown in Figure 3.To ensure precise recording, the sensor was placed over the chest of the participants in a supine position using a strap that held the sensor firmly against the skin while allowing for unrestricted breathing.This placement allowed the sensor to detect variations in diaphragmatic movement accurately.In addition, a radar sensor was placed in the room as a reference sensor to monitor breathing.The sensor placement accuracy and the data's reliability were verified and compared with simultaneous radar sensing.The resulting data provide essential information for evaluating abnormal breathing patterns in older adults and offer precise details on the kinetics of respiratory movements.

Movement Sensor Prototype
For accurate measurement of chest movement during respiratory cycles, the third prototype included an accelerometer and gyroscope sensor integrated with an ESP8266 NodeMCU, as shown in Figure 3.To ensure precise recording, the sensor was placed over the chest of the participants in a supine position using a strap that held the sensor firmly against the skin while allowing for unrestricted breathing.This placement allowed the sensor to detect variations in diaphragmatic movement accurately.In addition, a radar sensor was placed in the room as a reference sensor to monitor breathing.The sensor placement accuracy and the data's reliability were verified and compared with simultaneous radar sensing.The resulting data provide essential information for evaluating abnormal breathing patterns in older adults and offer precise details on the kinetics of respiratory movements.3.1.4.Radar Sensor Prototype A fourth prototype was created using a radar sensor called XeThru X4M200 [18].This sensor operates as a system-on-chip (SoC), removing the need for an additional microcontroller (see Figure 4).The sensor manufacturer provided software for data acquisition, which allowed real-time data acquisition when the sensor was placed between 1 and 5 m

Radar Sensor Prototype
A fourth prototype was created using a radar sensor called XeThru X4M200 [18].This sensor operates as a system-on-chip (SoC), removing the need for an additional microcontroller (see Figure 4).The sensor manufacturer provided software for data acquisition, which allowed real-time data acquisition when the sensor was placed between 1 and 5 m from the study subjects.The software provided critical data, including the number of breaths per minute (RPM).This sensor emits low-energy radio waves and reflects off objects, including the human body.By measuring the changes in the pattern of reflected waves caused by the expansion and contraction of the chest during breathing, the sensor accurately calculates the respiratory rate.This non-invasive detection method is particularly beneficial for continuous respiratory monitoring in clinical or home settings, as it minimizes patient discomfort and improves ease of use.Using this radar sensor prototype resulted in the generation of crucial data necessary for building a dataset to study abnormal breathing patterns in older adults.The selection of diverse IoMT prototypes and sensors allowed for a comprehensiv respiratory data collection, enriching our machine learning model and enhancing our abil ity to predict abnormal breathing patterns in older adults.

Dataset Construction
To move forward with the project, it was crucial to create a dataset.We used dat from the three prototypes we developed and the XeThru X4M200 sensor to accomplis this.This dataset will form the basis for training the machine learning model, which wi help predict abnormal respiratory rates in patients.It will provide more precise infor mation about their future health.
We collected data from three individuals, aged 19 to 24 and of both genders.We use the XeThru X4M200 radar sensor to test the prototypes we created.This method ensured that the recorded information was accurate and that the data calculated by the IoMT pro totypes were consistent with the radar sensor's readings, especially regarding respirator rates (RPM).We carefully selected various parameters to include in the dataset, which wa organized in the following structure:  The selection of diverse IoMT prototypes and sensors allowed for a comprehensive respiratory data collection, enriching our machine learning model and enhancing our ability to predict abnormal breathing patterns in older adults.

Dataset Construction
To move forward with the project, it was crucial to create a dataset.We used data from the three prototypes we developed and the XeThru X4M200 sensor to accomplish this.This dataset will form the basis for training the machine learning model, which will help predict abnormal respiratory rates in patients.It will provide more precise information about their future health.
We collected data from three individuals, aged 19 to 24 and of both genders.We used the XeThru X4M200 radar sensor to test the prototypes we created.This method ensured that the recorded information was accurate and that the data calculated by the IoMT prototypes were consistent with the radar sensor's readings, especially regarding respiratory rates (RPM).We carefully selected various parameters to include in the dataset, which was organized in the following structure:

•
Age: The age of the patient (numeric).Wheatley [19] documented the respiratory rate classification in adult patients and this classification was used to define the "Normal" parameter, as have other authors [20].During this data collection, a dataset with 213 records was created.It is essential to mention that the COVID-19 pandemic had a significant impact and posed limitations.Due to this, it was not possible to collect respiratory data from a larger sample size, as some of the prototypes required direct respiratory involvement.

Dataset Augmentation
Given the limited number of records obtained with the IoMT prototypes, owing to the constraints imposed by health regulations, a decision was made to perform data augmentation on the dataset.After a literature search, we found a comprehensive health dataset that included the respiratory rate variable from pulse oximeters and various age groups among adults.We processed this dataset to match the structure of our proposed dataset.It resulted in a dataset of approximately 25,000 records from individuals aged between 40 and 90 years, including both genders.Using data from pulse oximetry devices continues to be a part of the category of medical devices connected to the IoT, as they can provide real-time health data for patients.This choice of this dataset effectively supports our objective of using data from an IoMT system to address the health issue we are investigating.
Subsequently, the age range was narrowed to align with this project's scope, primarily focused on seniors aged 60 or older.Consequently, we obtained a dataset comprising 16,512 records featuring data from adults aged between 60 and 90 years, encompassing both genders [21].
By utilizing data augmentation, we significantly improved our dataset, increasing the quantity and diversity of respiratory rate data.This approach helped us to include a more comprehensive range of older adults, making our machine learning model more effective in identifying abnormal respiratory patterns within this population.Despite the difficulties presented by the pandemic, data augmentation allowed us to overcome data constraints to validate our research findings.
In summary, we obtained records from individuals aged between 19 and 24 during the initial data collection phase.This helped us validate the accuracy and functionality of our IoMT prototypes.However, as our target group comprised older adults, we needed to expand our dataset to reflect their age range.To achieve this, we resorted to data augmentation and included records from individuals between 40 and 90 years of age.We selected this age range based on the availability of reliable datasets.
Subsequently, to ensure our research aligned with the specific goal of studying abnormal breathing patterns in older people, we narrowed our age range to 60 and older.This final selection of 16,512 records represents the study's target population, enabling us to focus on the trends and patterns most relevant to this population.

Machine Learning Models
We will apply three distinct machine learning algorithms-K-nearest neighbors (K-NN), support vector machine (SVM), and gradient boosting-to our comprehensive dataset.The main objective is determining which algorithm is more effective in predicting abnormal respiratory patterns in elderly individuals.By utilizing the features provided, these algorithms will categorize respiratory patterns as either normal or abnormal.
The K-nearest neighbors (K-NN) algorithm classifies data points based on the majority class among their k-nearest neighbors [22].This proximity-based approach will help us differentiate between normal and abnormal respiratory patterns by measuring the proximity of data points in our feature space.We will explore various values of "k" to find the optimal number of neighbors for our dataset.
We will also use a support vector machine (SVM) as a classification algorithm.SVM is versatile and robust, known for its ability to find a hyperplane that maximizes the margin between different classes in the data [23].Our study aims to categorize respiratory patterns into either normal or abnormal.We will fine-tune different kernel functions and hyperparameters to optimize SVM's performance.
In machine learning, gradient boosting is an ensemble learning technique that combines the predictions of multiple weak learners to build a predictive model [24].This approach involves iteratively minimizing prediction errors to enhance the model's accuracy.As with other algorithms, we will experiment with different hyperparameters to optimize their performance in our analysis.

Data Preprocessing
Prior to applying these algorithms, we conducted an exploratory data analysis (EDA) to understand better the dataset we are working with.This process involves analyzing and visualizing patterns, relationships, and trends within the data before moving on to building and training models.Exploring the respiratory rate data allowed us to identify key features relevant to our predictive task [25].
Addressing class imbalance: Given the potential class imbalance between normal and abnormal respiratory patterns, we applied oversampling and under-sampling to balance the dataset [26].
Feature scaling: We normalized the features to ensure that all variables contribute equally to the models' predictions, regardless of their scale [27].
Data partitioning: The dataset was split into training and testing subsets to evaluate the performance of each algorithm.The split involved reserving 80% of the data for training and 20% for testing [28].

Model Evaluation
To gauge the performance of each machine learning algorithm, we utilized standard evaluation metrics [29], including precision, recall, F1-score, and the area under the receiver operating characteristic curve (AUC-ROC).
Precision * Recall Precision + Recall AUC-ROC: The area under the ROC curve depicting the models' trade-off between true and false positive rates. where: These metrics provided insights into the algorithms' capabilities to accurately classify normal and abnormal respiratory patterns while also considering false positives and negatives.

Hyperparameter Tuning
We undertook hyperparameter tuning techniques to identify the optimal hyperparameters for each algorithm [30].This process enabled us to maximize the predictive ability of each model.

Comparison
We compared the performance of the three models to discern the most effective algorithm for our predictive task [31].This process guided us toward selecting the best model for predicting abnormal respiratory patterns in older adults.

Cross-Validation
To mitigate the risk of overfitting and obtain more robust performance estimates, we employed the K-fold cross-validation method [32].
Ultimately, the results derived from applying K-NN, SVM, and gradient boosting empowered us to identify the most appropriate model for predicting abnormal respiratory patterns in older adults.The algorithm demonstrating the highest predictive accuracy and robustness will be recommended for further integration into healthcare applications.

Results
In this section, we will provide a detailed analysis of the findings from our research, which focuses on the ability of machine learning models to predict abnormal respiratory patterns in older adults.We will examine the evaluation metrics, feature importance, and confusion matrices of each algorithm to gain a deeper understanding of the potential of our approach in applying machine learning to use in IoMT wearable technology to respiratory healthcare for older adults.

Exploratory Data Analysis
This vital phase enables us to unearth essential insights from our dataset, laying the groundwork for subsequent modeling efforts.In this section, we delve into the outcomes of our EDA, unveiling the distributions of key numeric variables, assessing class imbalances, and examining the relationships between gender and respiratory patterns (as seen in Figure 5).Furthermore, we explore the correlations among these variables to inform our feature selection process.Ultimately, the results derived from applying K-NN, SVM, and gradient boosting empowered us to identify the most appropriate model for predicting abnormal respiratory patterns in older adults.The algorithm demonstrating the highest predictive accuracy and robustness will be recommended for further integration into healthcare applications.

Results
In this section, we will provide a detailed analysis of the findings from our research, which focuses on the ability of machine learning models to predict abnormal respiratory patterns in older adults.We will examine the evaluation metrics, feature importance, and confusion matrices of each algorithm to gain a deeper understanding of the potential of our approach in applying machine learning to use in IoMT wearable technology to respiratory healthcare for older adults.

Exploratory Data Analysis
This vital phase enables us to unearth essential insights from our dataset, laying the groundwork for subsequent modeling efforts.In this section, we delve into the outcomes of our EDA, unveiling the distributions of key numeric variables, assessing class imbalances, and examining the relationships between gender and respiratory patterns (as seen in Figure 5).Furthermore, we explore the correlations among these variables to inform our feature selection process.

Numeric Variable Distributions
The age distribution appears uniform, indicating a good representation of different age groups within the dataset.
The RPM distribution seems right-skewed, suggesting a higher frequency of lower values.

Variable Correlations
The correlations between variables are relatively low overall.The strongest correlation (though still moderate) is between RPM and respiratory pattern normality (−0.324), which makes sense, as higher or lower than normal RPM directly indicates abnormal respiratory patterns.
The other variables, "age" and "sex", have lower correlations with "normal", but they could still contribute to the predictive power of the model.

Class Imbalance
There is an evident class imbalance in the distribution of the target variable (normal) with "Yes" representing a substantial majority at 87.96%, while "No" accounts for the remaining 12.04%.This striking disparity implies that our predictive models could inad-

Numeric Variable Distributions
The age distribution appears uniform, indicating a good representation of different age groups within the dataset.
The RPM distribution seems right-skewed, suggesting a higher frequency of lower values.

Variable Correlations
The correlations between variables are relatively low overall.The strongest correlation (though still moderate) is between RPM and respiratory pattern normality (−0.324), which makes sense, as higher or lower than normal RPM directly indicates abnormal respiratory patterns.
The other variables, "age" and "sex", have lower correlations with "normal", but they could still contribute to the predictive power of the model.

Class Imbalance
There is an evident class imbalance in the distribution of the target variable (normal) with "Yes" representing a substantial majority at 87.96%, while "No" accounts for the remaining 12.04%.This striking disparity implies that our predictive models could inadvertently lean towards favoring the prevailing class, potentially undermining their ability to effectively detect abnormal respiratory patterns.This factor should be considered during the preprocessing stage to avoid model bias.
There is a noticeable variation in respiratory patterns between different genders, but it is not significant.Both genders generally exhibit typical respiratory patterns; however, this aspect requires further examination during the modeling process.
Figure 6 shows the class imbalances.
Information 2023, 14, x FOR PEER REVIEW 10 of 19 to effectively detect abnormal respiratory patterns.This factor should be considered during the preprocessing stage to avoid model bias.
There is a noticeable variation in respiratory patterns between different genders, but it is not significant.Both genders generally exhibit typical respiratory patterns; however, this aspect requires further examination during the modeling process.
Figure 6 shows the class imbalances.

Feature Scaling
In order to ensure that all variables contributed equally to our machine learning models, we employed the standard scaler to standardize the "Age" and "RPM" features.This crucial step ensures that each variable contributes equally to the model and prevents dominant scale features from overshadowing subtler yet important predictors.
In machine learning algorithms, it is necessary to preprocess data to ensure accurate model results.A standard practice in this regard is feature scaling.Specific algorithms such as K-nearest neighbors (K-NN) and support vector machine (SVM) are sensitive to variation in feature scales.Therefore, it is necessary to normalize features to ensure that each variable has equal importance in determining the distance between data points, regardless of its original scale.This is important as it prevents features with higher orders of magnitude from being disproportionately weighted in the final model decisions.In our study, we apply normalization to align with these principles and ensure that the results are as accurate and fair as possible.
Table 1 provide a glimpse into the first 5 rows of the scaled training set features and their corresponding labels.

Feature Scaling
In order to ensure that all variables contributed equally to our machine learning models, we employed the standard scaler to standardize the "Age" and "RPM" features.This crucial step ensures that each variable contributes equally to the model and prevents dominant scale features from overshadowing subtler yet important predictors.
In machine learning algorithms, it is necessary to preprocess data to ensure accurate model results.A standard practice in this regard is feature scaling.Specific algorithms such as K-nearest neighbors (K-NN) and support vector machine (SVM) are sensitive to variation in feature scales.Therefore, it is necessary to normalize features to ensure that each variable has equal importance in determining the distance between data points, regardless of its original scale.This is important as it prevents features with higher orders of magnitude from being disproportionately weighted in the final model decisions.In our study, we apply normalization to align with these principles and ensure that the results are as accurate and fair as possible.
Table 1 provide a glimpse into the first 5 rows of the scaled training set features and their corresponding labels.
These standardized feature values, denoted as "Age" and "RPM" have been transformed to have a mean of 0 and a standard deviation of 1, ensuring a consistent scale for our model inputs.Additionally, the "Normal" labels indicate whether the respiratory patterns for each corresponding record are considered normal (1) or not (0).

Data Partitioning
We strategically partitioned the dataset into an 80-20% split for training and testing, respectively, to both maximize the data available for model learning and ensure a robust evaluation of performance.More importantly, we adopted stratified sampling to maintain the original class distribution, a critical step given the identified class imbalance.This method not only prevents model bias but also reflects our commitment to developing a model that is as effective in practice as it is during testing, an essential consideration for deploying such models in a clinical setting.This strategic approach ensured that each subset, for training and testing, mirrored the proportions of the "Normal" and "Not Normal" classes in the overall dataset.By maintaining this balance, we aimed to facilitate a more accurate assessment of our models' generalizability and its ability to handle the inherent class imbalance, which is critical in predicting abnormal respiratory patterns in older adults.The dimensions of these datasets are summarized below:

Model Validation
To predict abnormal respiratory patterns in elderly individuals, we harnessed three distinctive machine learning algorithms: K-nearest neighbors (K-NN), support vector machine (SVM), and gradient boosting.Our study's selection of these algorithms was based on strategic considerations.K-NN is known for its simplicity and effectiveness in classification problems with datasets that have moderate dimensions, like our respiratory pattern data.SVM was chosen for its robustness and ability to handle high-dimensional feature spaces, making it suitable for complex, feature-rich datasets.Gradient boosting provides a powerful and flexible approach that can iteratively improve in areas where previous models may show weaknesses, thanks to its additive learning nature.These three algorithms have shown strong performance in the literature for similar classification tasks in healthcare.Furthermore, their diversity offers an interesting comparison of performance and computational complexity, allowing us to evaluate the balance between precision and efficiency in detecting abnormal respiratory patterns.
Let us look at each algorithm's training and prediction times.
All models exhibit fast training and prediction times, a promising sign for their use in real-time applications.These fast processing times make the models suitable for health monitoring through IoMT technologies.The models' high precision levels also indicate their potential for clinical use in detecting abnormal respiratory patterns in older adults.

Evaluation Metrics
We carefully evaluated the models, taking into account various relevant metrics.The detailed evaluation metrics for each model are presented in Table 2.The results of our predictive modeling showcase the capabilities of the machine learning models we employed (see Figure 7).The K-nearest neighbors (K-NN) model demonstrated exceptional predictive capacity, achieving a precision rate of 99.9% and boasting an AUC-ROC score of 99.9%.These metrics highlight the model's ability to classify abnormal respiratory patterns accurately.High precision rates indicate that K-NN could help reduce false alarms in respiratory monitoring systems.This is crucial for patient trust and compliance in remote health monitoring.However, although technical metrics are encouraging, it is essential to assess the model's performance critically in a clinical context.Real-world data complexity and patient variability come into play in such settings.The results of our predictive modeling showcase the capabilities of the machine learning models we employed (see Figure 7).The K-nearest neighbors (K-NN) model demonstrated exceptional predictive capacity, achieving a precision rate of 99.9% and boasting an AUC-ROC score of 99.9%.These metrics highlight the model's ability to classify abnormal respiratory patterns accurately.High precision rates indicate that K-NN could help reduce false alarms in respiratory monitoring systems.This is crucial for patient trust and compliance in remote health monitoring.However, although technical metrics are encouraging, it is essential to assess the model's performance critically in a clinical context.Real-world data complexity and patient variability come into play in such settings.
The support vector machine (SVM) showed strong performance by maintaining a balance between precision and recall at around 99.9%.Additionally, the SVM model scored an AUC-ROC of 99.9%, highlighting its ability to detect changes in respiratory patterns accurately.
The most noteworthy achievement was observed in the gradient boosting model, which achieved a precision rate of 100% and an AUC-ROC score of 100%.It showed a slight advantage in accurately classifying abnormal respiratory patterns in the test dataset compared to the previous models.The results prove the selected models' outstanding predictive abilities, solidifying their importance as practical aids for detecting abnormal respiratory patterns in older people.This opens up possibilities for their use in actual healthcare situations, where early diagnosis and treatment can significantly improve patient outcomes and reduce healthcare costs.

Confusion Matrices
Confusion matrices are essential in evaluating predictive models, providing key insights into the models' performance [33].By analyzing the confusion matrices, we can understand the predictive models' performance comprehensively, which is critical for making informed decisions.Next, we present and discuss the confusion matrices obtained from our models.The support vector machine (SVM) showed strong performance by maintaining a balance between precision and recall at around 99.9%.Additionally, the SVM model scored an AUC-ROC of 99.9%, highlighting its ability to detect changes in respiratory patterns accurately.
The most noteworthy achievement was observed in the gradient boosting model, which achieved a precision rate of 100% and an AUC-ROC score of 100%.It showed a slight advantage in accurately classifying abnormal respiratory patterns in the test dataset compared to the previous models.
The results prove the selected models' outstanding predictive abilities, solidifying their importance as practical aids for detecting abnormal respiratory patterns in older people.This opens up possibilities for their use in actual healthcare situations, where early diagnosis and treatment can significantly improve patient outcomes and reduce healthcare costs.

Confusion Matrices
Confusion matrices are essential in evaluating predictive models, providing key insights into the models' performance [33].By analyzing the confusion matrices, we can understand the predictive models' performance comprehensively, which is critical for making informed decisions.Next, we present and discuss the confusion matrices obtained from our models.
Figure 8 shows the confusion matrix for the K-nearest neighbors (K-NN).The top left quadrant represents the count of the true positives (TP), representing instances correctly classified as abnormal respiratory patterns, totaling 396 cases.On the top right, we find the number of false negatives (FN), indicating cases incorrectly labeled as normal when they were, in fact, abnormal, with a count of two.The bottom left quadrant pertains to false positives (FP), which denotes instances mistakenly classified as abnormal when normal; in this instance, there are none (0).Lastly, the bottom right quadrant corresponds to true negatives (TN), reflecting instances accurately classified as normal, with a count of 2905 cases.In summary, the K-NN model demonstrates an exceptional capacity to accurately identify abnormal respiratory patterns, characterized by a minimal number of false negatives and an absence of false positives.
Information 2023, 14, x FOR PEER REVIEW 13 of 19 Figure 8 shows the confusion matrix for the K-nearest neighbors (K-NN).The top left quadrant represents the count of the true positives (TP), representing instances correctly classified as abnormal respiratory patterns, totaling 396 cases.On the top right, we find the number of false negatives (FN), indicating cases incorrectly labeled as normal when they were, in fact, abnormal, with a count of two.The bottom left quadrant pertains to false positives (FP), which denotes instances mistakenly classified as abnormal when normal; in this instance, there are none (0).Lastly, the bottom right quadrant corresponds to true negatives (TN), reflecting instances accurately classified as normal, with a count of 2905 cases.In summary, the K-NN model demonstrates an exceptional capacity to accurately identify abnormal respiratory patterns, characterized by a minimal number of false negatives and an absence of false positives.The confusion matrix for the SVM model (see Figure 9) bears resemblance to that of the K-NN model, encompassing similar elements: Within this matrix are 393 instances of TP, signifying the correct classification of abnormal respiratory patterns.Additionally, it recorded five FN, denoting instances where abnormalities were erroneously classified as normal.There were two occurrences of FP, representing instances incorrectly labeled as abnormal when they were, in fact, normal.Lastly, the matrix contains 2903 TN, indicating instances correctly identified as normal respiratory patterns.
This matrix component congruence highlights the SVM model's consistent and robust performance, identifying abnormal respiratory patterns while effectively reducing false positives and negatives.The confusion matrix for the SVM model (see Figure 9) bears resemblance to that of the K-NN model, encompassing similar elements: Within this matrix are 393 instances of TP, signifying the correct classification of abnormal respiratory patterns.Additionally, it recorded five FN, denoting instances where abnormalities were erroneously classified as normal.There were two occurrences of FP, representing instances incorrectly labeled as abnormal when they were, in fact, normal.Lastly, the matrix contains 2903 TN, indicating instances correctly identified as normal respiratory patterns.
This matrix component congruence highlights the SVM model's consistent and robust performance, identifying abnormal respiratory patterns while effectively reducing false positives and negatives.When analyzing the gradient boosting model, its confusion matrix (see Figure 10) reflects the following statistics: it detected 398 TP without any FN or FP and counted 2903 TN.This accurate precision, where all abnormal respiratory patterns are correctly identified, along with a high true negative count, confirms the outstanding performance of this model.The analysis of the confusion matrices provided a detailed view of the models' performance, revealing the great capabilities of the models, each with unique strengths.

Cross-Validation
Our dataset's substantial volume of 16,512 observations provided a robust foundation for employing stratified five-fold cross-validation, ensuring that our evaluation was thorough and resistant to the variability that smaller datasets might introduce.This methodological choice reinforces the reliability of our findings, as each fold's consistent performance underscores the models' stability and potential readiness for clinical trials.This method ensures that the original distribution of the target variable is preserved in each fold, which is important because of the observed class imbalance.We When analyzing the gradient boosting model, its confusion matrix (see Figure 10) reflects the following statistics: it detected 398 TP without any FN or FP and counted 2903 TN.This accurate precision, where all abnormal respiratory patterns are correctly identified, along with a high true negative count, confirms the outstanding performance of this model.When analyzing the gradient boosting model, its confusion matrix (see Figure 10) reflects the following statistics: it detected 398 TP without any FN or FP and counted 2903 TN.This accurate precision, where all abnormal respiratory patterns are correctly identified, along with a high true negative count, confirms the outstanding performance of this model.The analysis of the confusion matrices provided a detailed view of the models' performance, revealing the great capabilities of the models, each with unique strengths.

Cross-Validation
Our dataset's substantial volume of 16,512 observations provided a robust foundation for employing stratified five-fold cross-validation, ensuring that our evaluation was thorough and resistant to the variability that smaller datasets might introduce.This methodological choice reinforces the reliability of our findings, as each fold's consistent performance underscores the models' stability and potential readiness for clinical trials.This method ensures that the original distribution of the target variable is preserved in each fold, which is important because of the observed class imbalance.We The analysis of the confusion matrices provided a detailed view of the models' performance, revealing the great capabilities of the models, each with unique strengths.

Cross-Validation
Our dataset's substantial volume of 16,512 observations provided a robust foundation for employing stratified five-fold cross-validation, ensuring that our evaluation was thorough and resistant to the variability that smaller datasets might introduce.This methodological choice reinforces the reliability of our findings, as each fold's consistent performance underscores the models' stability and potential readiness for clinical trials.This method ensures that the original distribution of the target variable is preserved in each fold, which is important because of the observed class imbalance.We chose this approach because it strikes a reasonable balance between robust evaluation and computational efficiency.the normalcy of respiratory patterns.A higher RPM may indicate potential abnormalities, highlighting the significance of this feature in our model.
Age is also a significant variable, with an importance score of 0.341.It indicates that an individual's age significantly impacts the model's ability to predict respiratory patterns, highlighting age as a crucial factor in this health concern.
Sex has a score of 0.000 and is not a significant predictor of respiratory pattern normality.Healthcare professionals and researchers can use feature importance insights to detect abnormal respiratory patterns early in older adults, highlighting the importance of RPM and age.

Discussion
Machine learning algorithms have made significant progress in predicting abnormal respiratory patterns.Specifically, three algorithms-K-nearest neighbors, support vector machine, and gradient boosting-have displayed excellent predictive capabilities.Gradient boosting stood out among these algorithms with nearly perfect scores in various evaluation metrics.
The number of breaths a person takes per minute, known as respirations per minute (RPM), and their age are important factors in predicting normal breathing patterns [35].The analysis found that sex has little impact on this prediction.These findings reinforce the idea that respiratory rate is a crucial factor in determining respiratory health and highlight the influence of age on respiratory normality.Some limitations emerge from our model evaluation.
Our models have achieved an exceptional level of accuracy, which is promising.However, this requires careful interpretation.Such remarkable performance metrics often require additional scrutiny to validate the models' suitability and protect against the risk of overfitting the training data [36].To mitigate this limitation of high accuracy, we implemented a multivariate approach.We employed five-fold stratified cross-validation to assess generalizability.
In addition, we measured the models' performance by considering precision, recall, F1 score and AUC-ROC.This provided a comprehensive evaluation, especially for classes with imbalanced data.We also analyzed the importance of features, which helped us identify crucial predictors and refine the feature set for better interpretability and generalization.Going forward, even though it is beyond the scope of this study, we plan to perform clinical validation with healthcare experts to align our models with their clinical expertise.
It is possible that our limited feature set could restrict the models' ability to understand all the factors that affect respiratory patterns, even though RPM and age are important features.To improve model performance without adding complexity, feature engineering can be used to create additional relevant features from existing data.
Developing and applying machine learning models in healthcare requires a meticulous, well-balanced approach.The preliminary findings of this study have significant implications.The capacity to accurately predict abnormal respiratory patterns enables early interventions and management strategies to mitigate respiratory issues, especially in elderly populations.
Moreover, making a real-world implementation of these models into healthcare systems and integrating them into IoMT systems could facilitate continuous respiratory monitoring, enabling timely interventions and enhancing healthcare delivery.

Conclusions
This exploratory study has demonstrated that machine learning can be a powerful tool in predicting abnormal respiratory patterns, mainly when applied within the Internet of Medical Things (IoMT) framework.The gradient boosting algorithm performed exceptionally well.These results suggest that computational models have the potential to help healthcare practitioners identify and manage respiratory anomalies more effectively.
We used a data augmentation method to overcome the limitation of having a small number of records from the IoMT prototypes.The initial database consisted of records collected from only three individuals between the ages of 19 and 24, which needed to be improved for our study.We added approximately 25,000 records from a trusted health database to expand the database.This database had respiratory rate records obtained from pulse oximeters for a broader range of ages (40 to 90 years).After a rigorous search, we selected this complementary database and processed it to match our proposed format.After augmenting the initial records, the resulting dataset had 5% direct and 95% augmented records.This process improved the quantity and diversity of the dataset, allowing our machine learning model to be trained on a more representative spectrum of breathing patterns for older adults.
Our study's key findings highlight the importance of RPM and age as predictive features in determining respiratory pattern normality.This discovery enhances our understanding of the factors influencing respiratory health and underscores their clinical relevance, especially when applied in IoMT systems.It also emphasizes how RPM and age can be helpful in real-world healthcare applications, especially in proactive management and intervention strategies for elderly populations susceptible to respiratory anomalies.
Our discoveries in this study provide new opportunities for further investigation and practical use in predicting respiratory health.However, ensuring that these models are robust, dependable, and ethically applied is crucial.Before implementing them in the real world, extensive validation, ethical considerations, and practical testing are necessary within the IoMT ecosystem and healthcare settings.
 Age: The age of the patient (numeric). RPM (respirations per minute): Numeric representation of the respiratory rate. Sex: The gender of the patient (numeric): a. 0 = female b. 1 = male  Normal: Indicator of whether the RPM falls within the normal range based on th patient's age and the ranges specified in the existing literature (numeric): a. 0 = no b. 1 = yes
• RPM (respirations per minute): Numeric representation of the respiratory rate.• Sex: The gender of the patient (numeric): a. 0 = female b. 1 = male• Normal: Indicator of whether the RPM falls within the normal range based on the patient's age and the ranges specified in the existing literature (numeric):

Figure 9 .
Figure 9. Confusion matrix for support vector machine.

Figure 9 .
Figure 9. Confusion matrix for support vector machine.

Figure 9 .
Figure 9. Confusion matrix for support vector machine.

Table 2 .
Evaluation metrics for each model.