**Abstract**

Wearable technology has added a whole new dimension in the healthcare system by real-time continuous monitoring of human body physiology. They are used in daily activities and fitness monitoring and have even penetrated in monitoring the health condition of patients suffering from chronic illnesses. There are a lot of research and development activities being pursued to develop more innovative and reliable wearable. This chapter will cover discussions on the design and implementation of wearable devices for different applications such as real-time detection of heart attack, abnormal heart sound, blood pressure monitoring, gait analysis for diabetic foot monitoring. This chapter will also cover how the signals acquired from these prototypes can be used for training machine learning (ML) algorithm to diagnose the condition of the person wearing the device. This chapter discusses the steps involved in (i) hardware design including sensors selection, characterization, signal acquisition, and communication to decision-making subsystem and (ii) the ML algorithm design including feature extraction, feature reduction, training, and testing. This chapter will use the case study of the design of smart insole for diabetic foot monitoring, wearable real-time heart attack detection, and smart-digital stethoscope system to show the steps involved in the development of wearable biomedical systems.

**Keywords:** machine learning, wearable medical devices, real-time detection, sensors for wearable devices

## **1. Introduction**

Healthcare is one of the most crucial application areas that require faster development. In the wearable medical device domain, there is a lot of scope of research and development. With the recent technological development, wearable medical devices become feasible for real-time monitoring and diagnosis of medical problems. It has been accelerated with the availability of cheaper component and advancement in wireless communication technology, which has also enabled the application of the Internet of Things (IoT) in the wearable biomedical applications. According to a report by Grand View Research Inc. [1], the Internet of Things (IoT) penetration in the health sector is expected to reach a volume of approximately \$ 409.9 billion by 2022. Thus, there is a huge boom in the wearable industry. There is a wide range of wearable devices that transmit medical information to mobile and

web applications over the wireless network, enabling remote health monitoring. The wearable medical devices face the challenges of reliability, accuracy, precision, and robustness [2]. There are two important sub-sections for a complete wearable medical device—(i) hardware, which involves the sensor selection and characterization, noise removal from the acquired signals, and communication to the decisionmaking subsystem and (ii) software, which involves taking decisions based on the acquired signals. The second subsystem is where the machine learning comes into play, and the recent outburst of development in the field of machine learning has increased the possibility of remote monitoring and diagnosing with the acquired data from the wearable devices. The machine learning block of the wearable devices involves various steps such as preprocessing, feature selection, training on the labeled dataset, and testing to verify its accuracy and competency. The various parts of the machine learning block will be discussed in details later in this chapter. Thus, it is inevitable that machine learning methods that include algorithm training are required to enable the diagnosis of different diseases. Examples of success in machine learning lead researchers to the adoption of neural networks and other classifiers for medical diagnostic applications. However, this requires ground truth in the form of accurately curated data sources from carefully constructed subject trials with a properly distributed subject population of significant size. Limitations in ground truth data may lead to inaccurate results from the classifiers. This also includes a novel set of challenges for the design and execution of subject trials that are essential in the development and training of algorithms, as well as verification of system performance. Different open-source databases were used for hardware evaluation. The chapter is intended to provide a guidance to the researchers in computing for healthcare who wish to adopt the compelling mission of wearable device development for healthcare diagnostics.

The chapter draws from the experience in the development of a series of biomedical devices from primary research done in the field of wearable devices for monitoring heart attack, abnormal heart sounds, gait analysis in diabetic foot monitoring, and blood pressure estimation using photoplethysmogram (PPG) signal. Therefore, in this chapter, four major health issues were discussed and how these issues can be well monitored without visiting hospital facilities were discussed. These experiments from various previously performed case studies by the team can help in providing a step-by-step roadmap on how to develop intelligent wearable biomedical system. Section 2 discusses the sensor selection and characterization process for a smart insole for gait analysis in diabetic foot monitoring. Section 3 discusses a case study, how continuous blood pressure can be estimated very accurately using PPG signal with the help of machine learning algorithm. Section 4 shows a wearable device for heart attack detection for the driver in a vehicle environment using classical machine learning approach, while Section 5 describes a wearable monitoring device, which is developed for heart sound monitoring to identify cardiovascular abnormality. Section 6 discusses the key contributions of the chapter along with the major results and their applications in real world. Finally, Section 7 concludes the chapter.

## **2. Smart insole for gait analysis**

Gait analysis is an important feature for diabetic foot monitoring. A force between the foot and ground, called the vertical ground reaction force (vGRF), can be acquired using different wearable sensors such as force sensors, strain gauges, magneto-resistive sensors, accelerometers, gyroscopes, and inclinometers or using different type of instruments such as force plate system and

**75**

**Figure 1.**

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

Analysis Lab as a calibration reference.

*Block diagram for a diabetic foot monitoring smart foot sole.*

multi-camera-based system. Despite the improvements in technology, the cost of the multi-camera setup is high and it requires a long post-processing time. Furthermore, the number of strides that can be captured is limited, making it not applicable for personal use. Some efforts from different research groups have been made to overcome the limitations of traditional force plates by equipping treadmills with few force plates [3]. However, treadmills impose restrictions as subjects cannot change their direction of walking. Therefore, an increase in research interest was observed toward the development of smart insoles, where wearable sensors can be employed to detect vGRF, joint movements, acceleration of lower extremities, and other gait variables [4]. Smart insole provides the researchers with a flexible, portable, and comfortable solution for vGRF measurement. It includes different features including monitoring, processing, and displaying plantar pressure using pressure sensors embedded in the insole. **Figure 1** shows the complete block diagram of such a wearable system, where the pressure sensor array is placed in a customized shoe above the control circuit. Pressure data have to be digitized in the insole subsystem before it is send via a Bluetooth to a host computer for post-processing and analysis. This subsystem is powered by a battery alongside a power management unit. Pressure data can then be analyzed to extract various gait characteristics for different gait applications. In this section, the design of smart soles to detect vGRF during gait, with two different types of low-cost commercial force sensor: FSRs and flexible piezoelectric sensors (**Figure 2**), is discussed. All the sensors can be calibrated, details of which can be found in [5], where a simple low-cost calibration method based on load cells has been shown to mitigate the need of expensive calibration devices or Motion

As shown in **Figure 3**, the most common places of foot plane where most of the pressure is exerted during gait are heal, metatarsal heads, hallux, and toe. These are

In each insole, 16 sensors were positioned to record pressure values in different locations of the foot sole as shown in **Figure 3b**. Since people typically do not exert pressure on the Medial arch area, there is no sensor placed in this area [8]. Sixteen FSRs/piezoelectric sensors were used to collect data from smart insole, as can be seen in **Figures 4** and **5**. Sixteen inputs were multiplexed to one output through a 16-to-1 multiplexer, then applied to an ADC input of the microcontroller, and sent to host computer. The acquisition circuit was connected to the microcontroller module using an insulated ribble cable to minimize wire path and electrical hazard. The instrumented insole was placed on the top of the insole of the user's shoe to acquire pressure data while the other end of the ribbon cable is connected to a small box with an adhesive strap to wrap around the leg. Real-time pressure data from different sensors were collected in the microcontroller and sent to a PC using

the places where the calibrated sensors are to be placed on the smart insole.

#### *Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

*Sports Science and Human Health - Different Approaches*

ment for healthcare diagnostics.

concludes the chapter.

**2. Smart insole for gait analysis**

web applications over the wireless network, enabling remote health monitoring. The wearable medical devices face the challenges of reliability, accuracy, precision, and robustness [2]. There are two important sub-sections for a complete wearable medical device—(i) hardware, which involves the sensor selection and characterization, noise removal from the acquired signals, and communication to the decisionmaking subsystem and (ii) software, which involves taking decisions based on the acquired signals. The second subsystem is where the machine learning comes into play, and the recent outburst of development in the field of machine learning has increased the possibility of remote monitoring and diagnosing with the acquired data from the wearable devices. The machine learning block of the wearable devices involves various steps such as preprocessing, feature selection, training on the labeled dataset, and testing to verify its accuracy and competency. The various parts of the machine learning block will be discussed in details later in this chapter. Thus, it is inevitable that machine learning methods that include algorithm training are required to enable the diagnosis of different diseases. Examples of success in machine learning lead researchers to the adoption of neural networks and other classifiers for medical diagnostic applications. However, this requires ground truth in the form of accurately curated data sources from carefully constructed subject trials with a properly distributed subject population of significant size. Limitations in ground truth data may lead to inaccurate results from the classifiers. This also includes a novel set of challenges for the design and execution of subject trials that are essential in the development and training of algorithms, as well as verification of system performance. Different open-source databases were used for hardware evaluation. The chapter is intended to provide a guidance to the researchers in computing for healthcare who wish to adopt the compelling mission of wearable device develop-

The chapter draws from the experience in the development of a series of biomedical devices from primary research done in the field of wearable devices for monitoring heart attack, abnormal heart sounds, gait analysis in diabetic foot monitoring, and blood pressure estimation using photoplethysmogram (PPG) signal. Therefore, in this chapter, four major health issues were discussed and how these issues can be well monitored without visiting hospital facilities were discussed. These experiments from various previously performed case studies by the team can help in providing a step-by-step roadmap on how to develop intelligent wearable biomedical system. Section 2 discusses the sensor selection and characterization process for a smart insole for gait analysis in diabetic foot monitoring. Section 3 discusses a case study, how continuous blood pressure can be estimated very accurately using PPG signal with the help of machine learning algorithm. Section 4 shows a wearable device for heart attack detection for the driver in a vehicle environment using classical machine learning approach, while Section 5 describes a wearable monitoring device, which is developed for heart sound monitoring to identify cardiovascular abnormality. Section 6 discusses the key contributions of the chapter along with the major results and their applications in real world. Finally, Section 7

Gait analysis is an important feature for diabetic foot monitoring. A force between the foot and ground, called the vertical ground reaction force (vGRF), can be acquired using different wearable sensors such as force sensors, strain gauges, magneto-resistive sensors, accelerometers, gyroscopes, and inclinometers or using different type of instruments such as force plate system and

**74**

multi-camera-based system. Despite the improvements in technology, the cost of the multi-camera setup is high and it requires a long post-processing time. Furthermore, the number of strides that can be captured is limited, making it not applicable for personal use. Some efforts from different research groups have been made to overcome the limitations of traditional force plates by equipping treadmills with few force plates [3]. However, treadmills impose restrictions as subjects cannot change their direction of walking. Therefore, an increase in research interest was observed toward the development of smart insoles, where wearable sensors can be employed to detect vGRF, joint movements, acceleration of lower extremities, and other gait variables [4]. Smart insole provides the researchers with a flexible, portable, and comfortable solution for vGRF measurement. It includes different features including monitoring, processing, and displaying plantar pressure using pressure sensors embedded in the insole.

**Figure 1** shows the complete block diagram of such a wearable system, where the pressure sensor array is placed in a customized shoe above the control circuit. Pressure data have to be digitized in the insole subsystem before it is send via a Bluetooth to a host computer for post-processing and analysis. This subsystem is powered by a battery alongside a power management unit. Pressure data can then be analyzed to extract various gait characteristics for different gait applications.

In this section, the design of smart soles to detect vGRF during gait, with two different types of low-cost commercial force sensor: FSRs and flexible piezoelectric sensors (**Figure 2**), is discussed. All the sensors can be calibrated, details of which can be found in [5], where a simple low-cost calibration method based on load cells has been shown to mitigate the need of expensive calibration devices or Motion Analysis Lab as a calibration reference.

As shown in **Figure 3**, the most common places of foot plane where most of the pressure is exerted during gait are heal, metatarsal heads, hallux, and toe. These are the places where the calibrated sensors are to be placed on the smart insole.

In each insole, 16 sensors were positioned to record pressure values in different locations of the foot sole as shown in **Figure 3b**. Since people typically do not exert pressure on the Medial arch area, there is no sensor placed in this area [8]. Sixteen FSRs/piezoelectric sensors were used to collect data from smart insole, as can be seen in **Figures 4** and **5**. Sixteen inputs were multiplexed to one output through a 16-to-1 multiplexer, then applied to an ADC input of the microcontroller, and sent to host computer. The acquisition circuit was connected to the microcontroller module using an insulated ribble cable to minimize wire path and electrical hazard. The instrumented insole was placed on the top of the insole of the user's shoe to acquire pressure data while the other end of the ribbon cable is connected to a small box with an adhesive strap to wrap around the leg. Real-time pressure data from different sensors were collected in the microcontroller and sent to a PC using

**Figure 1.** *Block diagram for a diabetic foot monitoring smart foot sole.*

#### **Figure 2.**

*(a) FSR sensor (Interlink Electronics) [6] and (b) piezoelectric sensor (Murata Manufacturing Co.) [7].*

#### **Figure 3.**

*Selected foot area for pressure acquiring (a) and array of pressure sensor (b).*

**Figure 4.** *FSR-based smart insole: top (a) and bottom (b).*

Bluetooth low energy interface, and in the PC, a graphical interface was used to display and analyze the signal.

A commercial smart insole system called F-scan, which is one of the best insoles currently available in the market, was used to validate the performance of the designed smart insole (**Figure 6a**). The F-scan system is designed with very thin flexible printed circuit board with 960 sensing points, and each point can measure pressure with eight-bit resolution with a sampling frequency of maximum 750 Hz. However, the F-scan system is very expensive; the wired system costs around \$13,000, while the wireless systems costs around \$17,000. On the other hand, the proposed instrumented insole costs only ~500\$. Typically the vGRF peak is only 10% of the subject's weight. So, the data were calibrated based on the subject's weight. The subject is supposed to stand on one foot for few seconds while wearing the smart insole, and the pressure is calculated for the purpose of calibration. If the subject's weight is higher than the pressure measured, the calibration was done by a calibration factor greater than 1 while the calibration factor is less than 1 for

**77**

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

**Figure 5.**

**Figure 6.**

*system (c).*

**Figure 7.**

*comfortability.*

patient's weight less than the applied pressure. Calibration factor was calculated in the similar way for the FSR insole. **Figure 6b** and **c** show the application of F-scan and FSR-based system on the same subject while acquiring the vGRF signal. The FSR-based smart insole can acquire high-quality vGRF for different gait cycles, as seen in **Figure 7**, and it was found that the flexible piezoelectric sensors were performing poor in calibration due to their sensitivity to 3D forces requiring special force calibration machines to control the applied force in x, y, or z directions. Therefore, piezoelectric sensors cannot be utilized as a substitute for FSR in designing smart insole. However, the piezoelectric sensors if calibrated properly can be used to

*Comparison between the mean and standard deviation of vertical ground reaction forces (vGRFs) from left* 

*(blue) and right (orange) foot using F-scan system (a) and FSR-based system (b).*

*(a) Piezo insole with 16 piezo sensors and (b) additional insole layer placed on the top of piezo insole to ensure* 

*Commercial F-scan smart insole (a), subject 01 is wearing the F-scan system (b), and FSR-based prototype* 

**3. Estimating blood pressure from the photoplethysmogram signal**

It is very important to monitor the blood pressure as high blood pressure puts a huge amount of strain on the arteries and the heart, resulting in increase in the

detect the starting and ending of each gait cycle.

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

**Figure 5.**

*Sports Science and Human Health - Different Approaches*

**76**

**Figure 4.**

**Figure 3.**

**Figure 2.**

*FSR-based smart insole: top (a) and bottom (b).*

*Selected foot area for pressure acquiring (a) and array of pressure sensor (b).*

display and analyze the signal.

Bluetooth low energy interface, and in the PC, a graphical interface was used to

*(a) FSR sensor (Interlink Electronics) [6] and (b) piezoelectric sensor (Murata Manufacturing Co.) [7].*

currently available in the market, was used to validate the performance of the designed smart insole (**Figure 6a**). The F-scan system is designed with very thin flexible printed circuit board with 960 sensing points, and each point can measure pressure with eight-bit resolution with a sampling frequency of maximum 750 Hz. However, the F-scan system is very expensive; the wired system costs around \$13,000, while the wireless systems costs around \$17,000. On the other hand, the proposed instrumented insole costs only ~500\$. Typically the vGRF peak is only 10% of the subject's weight. So, the data were calibrated based on the subject's weight. The subject is supposed to stand on one foot for few seconds while wearing the smart insole, and the pressure is calculated for the purpose of calibration. If the subject's weight is higher than the pressure measured, the calibration was done by a calibration factor greater than 1 while the calibration factor is less than 1 for

A commercial smart insole system called F-scan, which is one of the best insoles

*(a) Piezo insole with 16 piezo sensors and (b) additional insole layer placed on the top of piezo insole to ensure comfortability.*

#### **Figure 6.**

*Commercial F-scan smart insole (a), subject 01 is wearing the F-scan system (b), and FSR-based prototype system (c).*

#### **Figure 7.**

*Comparison between the mean and standard deviation of vertical ground reaction forces (vGRFs) from left (blue) and right (orange) foot using F-scan system (a) and FSR-based system (b).*

patient's weight less than the applied pressure. Calibration factor was calculated in the similar way for the FSR insole. **Figure 6b** and **c** show the application of F-scan and FSR-based system on the same subject while acquiring the vGRF signal.

The FSR-based smart insole can acquire high-quality vGRF for different gait cycles, as seen in **Figure 7**, and it was found that the flexible piezoelectric sensors were performing poor in calibration due to their sensitivity to 3D forces requiring special force calibration machines to control the applied force in x, y, or z directions. Therefore, piezoelectric sensors cannot be utilized as a substitute for FSR in designing smart insole. However, the piezoelectric sensors if calibrated properly can be used to detect the starting and ending of each gait cycle.

#### **3. Estimating blood pressure from the photoplethysmogram signal**

It is very important to monitor the blood pressure as high blood pressure puts a huge amount of strain on the arteries and the heart, resulting in increase in the

probability of clogging of lumens. This clot (clogging of lumens) may cause several health problems such as heart attack, stroke, kidney diseases, and dementia. Thus, continuous blood pressure monitoring, at least four times daily at regular intervals, is preferable. Photoplethysmography (PPG) can be used for measuring the amount of light absorbed or reflected by blood vessels in the living tissue which can be extended to different aspects of cardiovascular surveillance including identification of blood oxygen saturation, heart rate, BP estimation, cardiac output, respiration, arterial aging, endothelial control, microvascular blood flow, and autonomic function. PPG waveforms generally have three distinct features—systolic peak, diastolic peak, and a notch in between—as shown in **Figure 8**.

This section will discuss how the less cumbersome method of PPG signal acquisition can be used in estimating blood pressure, details of which can be found in [9]. This section will also discuss how a trained network using reliable labeled dataset can be used in such a study.

#### **3.1 Dataset**

The dataset used in this study was taken from Liang et al. [10], which is publicly available. The dataset contained 657 PPG signal samples from 219 subjects. PPG signals were first assessed to check the signal quality and then randomly divided into two sets. Then, 85% of the data were used for training and validation, and 15% of the data were used for testing the performance of the model. The PPG signals were preprocessed before they were sent for feature extraction. After extracting meaningful features, feature selection techniques were used to reduce computational complexity and the chance of over-fitting the algorithm. The features were then used to train machine learning algorithms. The best regression model was selected for SBP and DBP estimation individually. In the quality assurance process, 222 signals from 126 subjects were finally kept for this study. **Figure 9** shows the sample PPG signal which was divided into fit and unfit for the study.

#### **3.2 Normalization and filtration**

To extract meaningful information from the signals, it was necessary to normalize all the signals. The Z-score technique was used to normalize the signals in this study to get amplitude-limited data. The normalized signal is passed into a low-pass Butterworth filter to remove the high frequency that is acquired by the signal.

#### **3.3 Baseline correction**

The PPG waveform is commonly contaminated with a baseline wandering due to respiration at frequencies ranging from 0.15 to 0.5 Hz. Therefore, it is very important that the signal is properly filtered to remove the baseline wandering but that important information is preserved as far as possible. A polynomial fit was used to find the trend in the signal and subtracted to get the baseline corrected signal, as shown in **Figure 10**. The next step is to extract features from the preprocessed signal.

#### **3.4 Feature extraction**

The block diagram summarizing the feature extraction details adopted in the study is shown in **Figure 11**. A PPG waveform contains many informative information such as systole, diastole, notch, pulse width, and peak-to-peak interval. Some of the

**79**

**Figure 9.**

**Figure 8.**

distinctive features of the PPG waveform might not be dominant in some patients,

*Comparison of waveforms that are fit and unfit for the study. (a) Fit data and (b) unfit data.*

*A typical photoplethysmography (PPG) waveform with notch, systolic peak, and diastolic peak.*

Feature selection or reduction is important to reduce the risk of over-fitting the algorithms. In this section, three feature selection methods: correlation-based

such as the notch prevalence changing with age.

**3.5 Feature reduction**

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

#### **Figure 8.**

*Sports Science and Human Health - Different Approaches*

peak, and a notch in between—as shown in **Figure 8**.

can be used in such a study.

**3.2 Normalization and filtration**

**3.3 Baseline correction**

**3.4 Feature extraction**

**3.1 Dataset**

probability of clogging of lumens. This clot (clogging of lumens) may cause several health problems such as heart attack, stroke, kidney diseases, and dementia. Thus, continuous blood pressure monitoring, at least four times daily at regular intervals, is preferable. Photoplethysmography (PPG) can be used for measuring the amount of light absorbed or reflected by blood vessels in the living tissue which can be extended to different aspects of cardiovascular surveillance including identification of blood oxygen saturation, heart rate, BP estimation, cardiac output, respiration, arterial aging, endothelial control, microvascular blood flow, and autonomic function. PPG waveforms generally have three distinct features—systolic peak, diastolic

This section will discuss how the less cumbersome method of PPG signal acquisition can be used in estimating blood pressure, details of which can be found in [9]. This section will also discuss how a trained network using reliable labeled dataset

The dataset used in this study was taken from Liang et al. [10], which is publicly available. The dataset contained 657 PPG signal samples from 219 subjects. PPG signals were first assessed to check the signal quality and then randomly divided into two sets. Then, 85% of the data were used for training and validation, and 15% of the data were used for testing the performance of the model. The PPG signals were preprocessed before they were sent for feature extraction. After extracting meaningful features, feature selection techniques were used to reduce computational complexity and the chance of over-fitting the algorithm. The features were then used to train machine learning algorithms. The best regression model was selected for SBP and DBP estimation individually. In the quality assurance process, 222 signals from 126 subjects were finally kept for this study. **Figure 9** shows the

sample PPG signal which was divided into fit and unfit for the study.

To extract meaningful information from the signals, it was necessary to normalize all the signals. The Z-score technique was used to normalize the signals in this study to get amplitude-limited data. The normalized signal is passed into a low-pass Butterworth filter to remove the high frequency that is acquired by the

The PPG waveform is commonly contaminated with a baseline wandering due to respiration at frequencies ranging from 0.15 to 0.5 Hz. Therefore, it is very important that the signal is properly filtered to remove the baseline wandering but that important information is preserved as far as possible. A polynomial fit was used to find the trend in the signal and subtracted to get the baseline corrected signal, as shown in **Figure 10**. The next step is to extract features from the preprocessed signal.

The block diagram summarizing the feature extraction details adopted in the study is shown in **Figure 11**. A PPG waveform contains many informative information such as systole, diastole, notch, pulse width, and peak-to-peak interval. Some of the

**78**

signal.

*A typical photoplethysmography (PPG) waveform with notch, systolic peak, and diastolic peak.*

#### **Figure 9.**

*Comparison of waveforms that are fit and unfit for the study. (a) Fit data and (b) unfit data.*

distinctive features of the PPG waveform might not be dominant in some patients, such as the notch prevalence changing with age.

#### **3.5 Feature reduction**

Feature selection or reduction is important to reduce the risk of over-fitting the algorithms. In this section, three feature selection methods: correlation-based

#### **Figure 10.**

*Baseline correction of PPG waveform. (a) PPG waveform with the baseline wandering and fourth degree polynomial trend and (b) PPG waveform after detrending.*

#### **Figure 11.** *Overview of feature extraction.*

feature selection (CFS), ReliefF features selection, and features for classification using the minimum redundancy maximum relevance (fscmrmr) algorithm is discussed. ReliefF is a feature selection algorithm, which randomly selects instances and adjusts the weights of the respective element depending on the nearest neighbor. Correlation is a test used to evaluate whether or not a feature is highly correlated with the class or not highly correlated with any of the other features. On the other hand, the fscmrmr algorithm finds an optimal set of features that are mutually as dissimilar as possible and can effectively represent the response variable. The algorithm minimizes a feature set's inconsistency and maximizes the relevance of a feature set to the answer variable. MATLAB built-in functions can be used for CFS, ReliefF, and fscmrmr feature selection algorithms.

After the features were extracted, the feature matrix was trained with machine learning algorithms. The Regression Learner App of MATLAB 2019b was used to estimate the BP. Five different algorithms [linear regression, regression trees, support vector regression (SVR), Gaussian process regression (GPR), and ensemble trees] with their variations to a total of 19 algorithms were trained using the 10-fold

**81**

**3.6 Results**

*pressure (DBP) after optimization.*

**Table 1.**

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

> **Performance criteria**

**Optimized GPR**

ReliefF MAE **3.02** 11.32 **1.74** 5.99

FSCMRMR MAE 6.11 14.65 6.80 8.22

CFS MAE 12.95 16.27 7.59 7.89

**Selection criteria**

Features from the literature

All features (newly designed and from the literature)

cross-validation. Out of all these algorithms, two best performing algorithms,

*Evaluation of the outperforming algorithms for estimating systolic blood pressure (SBP) and diastolic blood* 

To evaluate the performance of the ML algorithms for estimating BP, it is important to select proper metrics, i.e., four in this case and are stated below. Here, Xp is the predicted data while the ground truth data is X and n is the number of samples.

<sup>1</sup> Mean absolute error, MAE *<sup>p</sup> <sup>n</sup> X X*

Root mean squared error, RMSE MSE

Mean squared error, MSE

*<sup>n</sup>* = − ∑ (1)

= (2)

∑ − <sup>=</sup> <sup>=</sup> (3)

2

2

*X X <sup>p</sup> n* ∑ −

**Systolic blood pressure Diastolic blood pressure**

**Optimized GPR**

**Optimized ensemble trees**

**Optimized ensemble trees**

MAE 6.79 12.43 4.49 8.17 MSE 180.99 231.15 70.06 104.45 RMSE 13.45 15.20 8.37 10.27 R 0.79 0.73 0.74 0.57

MAE 3.30 10.886 2.81 7.96 MSE 72.95 264.24 30.70 111.97 RMSE 8.54 16.25 5.54 10.58 R 0.92 0.67 0.90 0.56

MSE **45.49** 284.69 **12.89** 62.04 RMSE **6.74** 16.84 **3.59** 7.88 R **0.95** 0.65 **0.96** 0.78

MSE 108.96 321.63 77.26 110.84 RMSE 10.44 17.93 8.78 10.53 R 0.88 0.58 0.72 0.56

MSE 361.96 448.25 108.43 106.72 RMSE 19.02 21.17 10.41 10.33 R 0.50 0.28 0.57 0.58

> *X X <sup>p</sup> n*

Gaussian process regression and ensemble trees, were tested.


*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

#### **Table 1.**

*Sports Science and Human Health - Different Approaches*

*polynomial trend and (b) PPG waveform after detrending.*

feature selection (CFS), ReliefF features selection, and features for classification using the minimum redundancy maximum relevance (fscmrmr) algorithm is discussed. ReliefF is a feature selection algorithm, which randomly selects instances and adjusts the weights of the respective element depending on the nearest neighbor. Correlation is a test used to evaluate whether or not a feature is highly correlated with the class or not highly correlated with any of the other features. On the other hand, the fscmrmr algorithm finds an optimal set of features that are mutually as dissimilar as possible and can effectively represent the response variable. The algorithm minimizes a feature set's inconsistency and maximizes the relevance of a feature set to the answer variable. MATLAB built-in functions can be used for CFS,

*Baseline correction of PPG waveform. (a) PPG waveform with the baseline wandering and fourth degree* 

After the features were extracted, the feature matrix was trained with machine learning algorithms. The Regression Learner App of MATLAB 2019b was used to estimate the BP. Five different algorithms [linear regression, regression trees, support vector regression (SVR), Gaussian process regression (GPR), and ensemble trees] with their variations to a total of 19 algorithms were trained using the 10-fold

ReliefF, and fscmrmr feature selection algorithms.

**80**

**Figure 10.**

**Figure 11.**

*Overview of feature extraction.*

*Evaluation of the outperforming algorithms for estimating systolic blood pressure (SBP) and diastolic blood pressure (DBP) after optimization.*

cross-validation. Out of all these algorithms, two best performing algorithms, Gaussian process regression and ensemble trees, were tested.

#### **3.6 Results**

To evaluate the performance of the ML algorithms for estimating BP, it is important to select proper metrics, i.e., four in this case and are stated below. Here, Xp is the predicted data while the ground truth data is X and n is the number of samples.

$$\text{Mean absolute error, MAE} = \frac{1}{n} \sum\_{n} \left| X\_p - X \right| \tag{1}$$

$$\text{Mean squared error}, \text{MSE} = \frac{\sum \left| X\_p - X \right|^2}{n} \tag{2}$$

$$\text{Root mean squared error, RMSE} = \sqrt{\frac{\sum \left| X\_p - X \right|^2}{n}} = \sqrt{\text{MSE}} \tag{3}$$

$$\text{Correlation coefficient}, R = \sqrt{1 - \frac{\text{MSE} \, \text{(Model)}}{\text{MSE} \, \text{(Baseline)}}}\tag{4}$$

$$\text{where } \text{MSE} \, \text{(baseline)} = \frac{\sum \left| X - \text{mean} \, (X) \right|^2}{n}$$

When using the Regression Learner App in MATLAB, the above criteria are automatically calculated by MATLAB and these values can be used to evaluate the performance of the algorithms.

In **Table 1**, it can be noticed that the ReliefF feature selection algorithm produced the best result when combined with GPR. The feature selected using a combination of ReliefF and GPR performed the best in estimating SBP, while CFS and GPR performed best for DBP. Moreover, R scored 0.74 and 0.68 for SBP and DBP, respectively, which means that there is a strong correlation with the predictors and the ground truth.

### **4. Wearable real-time heart attack detection**

Myocardial infarction (MI), commonly known as heart attack, is considered one among the reasons of human death and disability worldwide. Although a heart attack is life threatening, it has early symptoms and signs that could be measured to help save many lives and to avoid consequences. There are three types of a heart attack: STEMI, NSTEMI, and coronary spasm, refer **Figure 12**.

Several ECG ambulatory monitoring systems are available, but they require time and effort to acquire ECG signals from patients. Furthermore, the ECG data have to be sent to professionals for diagnostic analysis. A wearable ECG device can be a solution to acquire real-time ECG signals from the patient. Then, signals are interpreted using built-in algorithms to observe abnormality events of ECG signals and sudden heart attack. Therefore, proper action can be made.

In terms of algorithm, some systems used linear classification and support vector machine (SVM). Some research studies have used the PhysioBank MI database to develop SVM-based real-time MI detection system with a classification accuracy of 90%. Another work came up with the solution for the motion artifact correction for the two-electrode ECG system with an optimized adaptive filter.

In this section, a wearable heart attack detector and alarming system is discussed, which can be used to reduce road accidents that might result from the driver being precipitated by a heart attack, details of which are present in [11]. A portable wearable system that can continuously monitor the heart condition for any early symptoms could inform the patient to pull over the vehicle safely before losing consciousness to avoid potentially fatal consequences. Moreover, medical caregivers could arrive and provide the necessary medical procedures that rescue the consequences of a heart attack.

#### **4.1 Wearable system prototype description**

The real-time heart attack monitoring wearable prototype system consists of two subsystems as shown in **Figure 13**. The subsystems communicate wirelessly using Bluetooth low energy (BLE) technology.

A wearable sensor subsystem is responsible for real-time ECG signal acquisition, amplification, filtering, digitization, and wireless transmission. The device is attached to a chest belt to be worn by a driver as shown in **Figure 13**. The device

**83**

system using BLE.

**Figure 12.**

**Figure 13.**

*NSTEMI (c).*

RPi3 using a low power shield.

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

includes three dry electrodes (one electrode for reference and two electrodes for differential acquisition) connected to an analog front end (AFE) and an RFduino microcontroller with an embedded BLE module. Furthermore, the designed module incorporates several features to enhance the overall performance including lead-off detection, single-supply operation, adjustable gain control, rail-to-rail output, a three-pole adjustable low-pass filter (LPF), a two-pole adjustable high-pass filter (HPF), and an integrated right-leg drive (RLD). A notch filter in Wien bridge configuration was used to remove the line frequency (50 Hz) from the measured ECG signal. The acquired and preprocessed ECG signal was sent to the decision-making

*Block diagram of the wearable heart attack detection prototype.*

*Comparison of the ST segment variations in a normal subject (a) and in MI patients with STEMI (b) and* 

The intelligent heart attack detection and warning subsystems are trained using the Massachusetts Institute of Technology-Beth Israel Hospital (MIT-BIH) ST Change Database [12]. This subsystem consists of a single board computer, Raspberry Pi 3 (RPi3). The acquired ECG signal from RFduino is delivered to RPi3 over the Bluetooth low energy (BLE) interface. ECG data are buffered for 10 s, and the baseline drift is corrected, segmented to ECG beats (one ECG trace), and smoothened using a digital filter. Furthermore, the subsystem incorporates SIM 908 global system for mobile communications (GSM) and the global positioning system (GPS) module; the module is directly connected to

Twenty-two different machine learning (ML) algorithms were trained for realtime ECG classification. Experiments were done in two stages. In the first stage, the public labeled database "MIT-BIH ST Change Database" covers both normal and abnormal subjects. Twenty-eight subjects' ECG recordings with 14 subjects' ECG recordings were normal, seven patients had T-inversion, and the other patients

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

**Figure 12.**

*Sports Science and Human Health - Different Approaches*

where ( ) ( )

**4. Wearable real-time heart attack detection**

attack: STEMI, NSTEMI, and coronary spasm, refer **Figure 12**.

and sudden heart attack. Therefore, proper action can be made.

the two-electrode ECG system with an optimized adaptive filter.

∑ − <sup>=</sup>

MSE baseline

performance of the algorithms.

ground truth.

MSE Model Correlation coefficient, 1 MSE Baseline

When using the Regression Learner App in MATLAB, the above criteria are automatically calculated by MATLAB and these values can be used to evaluate the

the best result when combined with GPR. The feature selected using a combination of ReliefF and GPR performed the best in estimating SBP, while CFS and GPR performed best for DBP. Moreover, R scored 0.74 and 0.68 for SBP and DBP, respectively, which means that there is a strong correlation with the predictors and the

In **Table 1**, it can be noticed that the ReliefF feature selection algorithm produced

Myocardial infarction (MI), commonly known as heart attack, is considered one among the reasons of human death and disability worldwide. Although a heart attack is life threatening, it has early symptoms and signs that could be measured to help save many lives and to avoid consequences. There are three types of a heart

Several ECG ambulatory monitoring systems are available, but they require time and effort to acquire ECG signals from patients. Furthermore, the ECG data have to be sent to professionals for diagnostic analysis. A wearable ECG device can be a solution to acquire real-time ECG signals from the patient. Then, signals are interpreted using built-in algorithms to observe abnormality events of ECG signals

In terms of algorithm, some systems used linear classification and support vector machine (SVM). Some research studies have used the PhysioBank MI database to develop SVM-based real-time MI detection system with a classification accuracy of 90%. Another work came up with the solution for the motion artifact correction for

In this section, a wearable heart attack detector and alarming system is discussed, which can be used to reduce road accidents that might result from the driver being precipitated by a heart attack, details of which are present in [11]. A portable wearable system that can continuously monitor the heart condition for any early symptoms could inform the patient to pull over the vehicle safely before losing consciousness to avoid potentially fatal consequences. Moreover, medical caregivers could arrive and provide the necessary medical procedures that rescue the conse-

The real-time heart attack monitoring wearable prototype system consists of two subsystems as shown in **Figure 13**. The subsystems communicate wirelessly

A wearable sensor subsystem is responsible for real-time ECG signal acquisition, amplification, filtering, digitization, and wireless transmission. The device is attached to a chest belt to be worn by a driver as shown in **Figure 13**. The device

mean

*X X n*

2

( ) ( )

*R* = − (4)

**82**

quences of a heart attack.

**4.1 Wearable system prototype description**

using Bluetooth low energy (BLE) technology.

*Comparison of the ST segment variations in a normal subject (a) and in MI patients with STEMI (b) and NSTEMI (c).*

**Figure 13.** *Block diagram of the wearable heart attack detection prototype.*

includes three dry electrodes (one electrode for reference and two electrodes for differential acquisition) connected to an analog front end (AFE) and an RFduino microcontroller with an embedded BLE module. Furthermore, the designed module incorporates several features to enhance the overall performance including lead-off detection, single-supply operation, adjustable gain control, rail-to-rail output, a three-pole adjustable low-pass filter (LPF), a two-pole adjustable high-pass filter (HPF), and an integrated right-leg drive (RLD). A notch filter in Wien bridge configuration was used to remove the line frequency (50 Hz) from the measured ECG signal. The acquired and preprocessed ECG signal was sent to the decision-making system using BLE.

The intelligent heart attack detection and warning subsystems are trained using the Massachusetts Institute of Technology-Beth Israel Hospital (MIT-BIH) ST Change Database [12]. This subsystem consists of a single board computer, Raspberry Pi 3 (RPi3). The acquired ECG signal from RFduino is delivered to RPi3 over the Bluetooth low energy (BLE) interface. ECG data are buffered for 10 s, and the baseline drift is corrected, segmented to ECG beats (one ECG trace), and smoothened using a digital filter. Furthermore, the subsystem incorporates SIM 908 global system for mobile communications (GSM) and the global positioning system (GPS) module; the module is directly connected to RPi3 using a low power shield.

Twenty-two different machine learning (ML) algorithms were trained for realtime ECG classification. Experiments were done in two stages. In the first stage, the public labeled database "MIT-BIH ST Change Database" covers both normal and abnormal subjects. Twenty-eight subjects' ECG recordings with 14 subjects' ECG recordings were normal, seven patients had T-inversion, and the other patients

experienced long-term recordings that showed ST elevation and depression. The system was tested on normal subjects, and an ECG simulator was used to simulate abnormal ST-elevated MI situations to test the performance of the complete system in real time.

#### **4.2 Preprocessing**

Due to body movements, even respiration, muscle signal, and power line interference of 50 Hz, filtering stage was essential to filter the signal and eliminate the inherent noises. In addition, ECG was often affected by artifacts constituted through electrodes or the interference of the signal processing hardware. Finite impulse response filter (FIR) based on window method was used to smooth the noisy signal by slicing the array of data into selected length windows, computing averages of the data within that range, and maintaining the process throughout the dataset using the moving-average filter.

Baseline wander correction technique and continuous wavelet transformation were used for synthesizing the ECG signal; the wavelet was able to show how the frequency component varied within certain ranges of time. The ECG signals were segmented into traces. A total of 3500 ECG traces over 28 different subjects were considered. Therefore, the total number of ECG traces considered in this study was 10,500.

#### **4.3 Feature extraction**

Different features were investigated from time, frequency, and time-frequency domains. **Table 2** shows the t-domain, the f-domain, and the (t, f) domain features extracted.

### **4.4 Training process**

A five-fold cross-validation technique was used in the testing and training process. Weighted performance matrix was created by averaging the results of all the iterations. The averages of all scoring matrices were calculated for the four iterations along with their standard deviation. Performance evaluations of three different timefrequency distributions (TFDs) were calculated to identify which TFD produced higher accuracy. In addition, the receiver operating characteristic (ROC) analysis was used to evaluate the performance of the ML algorithm for classification confusion matrix and several standard statistical evaluation parameters were used to evaluate the performance of the algorithms including sensitivity, false positive rate (FPR), F1 score, and accuracy.


**85**

**Table 4.**

*Evaluation parameters in classifying ST elevation.*

*Machine Learning in Wearable Biomedical Systems DOI: http://dx.doi.org/10.5772/intechopen.93228*

for the extended modified B distribution.

All the features listed in **Table 2** were extracted to evaluate the performance of each feature. AUC were calculated as shown in **Table 3**. All features that scored a minimum of 0.5 and above were useful to apply to the classifiers. It was noticed that all the selected features fulfilled the requirement for all of the distributions. Hence, all the features were used for training, validation, and testing. A five-fold cross-validation was used to compute the ML algorithms validation accuracy. **Tables 4** and **5** demonstrate the accuracies resulting from classifying ST elevation and T-wave inversion for the three different (t, f) distributions. Also, both tables showed the two best performing algorithms, the support vector machine (SVM) and the k-nearest neighbors (KNNs). It was noticed that SVM outperformed KNN

As shown from **Tables 4** and **5**, EMBD outperformed the others in classifying ST elevation and T-wave inversion. Moreover, the variance showed that the variation for different iterations was at the minimum for the EMBD distribution (**Table 3**). Thus, EMBD distribution was more robust to noisy data. EMBD distributions were implemented for real-time classification using Python. The results showed that both the recall and the precision were reasonable for reliable detection, and for both positive and negative classifications. This can be observed in the F score as well.

**Features WVD SPEC EMBD**

Mean 0.53 0.67 0.53 0.75 0.53 0.75 Variance 0.51 0.71 0.51 0.66 0.51 0.58 Skewness 0.68 0.57 0.68 0.67 0.68 0.57 Kurtosis 0.75 0.57 0.75 0.69 0.75 0.56

Spectral flux 0.76 0.82 0.76 0.83 0.76 0.55

*Results of the ROC analysis of the t-domain, f-domain, and (t, f) domain features for the ST elevation* 

**Parameters/ML algorithms WVD SPEC EMBD**

Recall (TPR) (%) 92 89 89 90 99.1 96.7 FPR (%) 11 12 14 13 1.7 3.8 Precision (%) 89 88 86 87 98.3 96.2 F score (%) 90.5 88.9 87.5 86 98.7 97 Accuracy (%) 87.1 86.4 85.3 84.2 97.4 95.9

**Original Joint (t, f) Original Joint (t, f) Original Joint (t, f)**

0.50 0.74 0.50 0.65 0.50 0.58

0.54 0.71 0.54 0.79 0.54 0.68

0.81 0.71 0.81 0.65 0.81 0.59

**SVM KNN SVM KNN SVM KNN**

**4.5 Results**

Coefficient of variation

Spectral flatness

Spectral entropy

**Table 3.**

*detection.*

#### **Table 2.**

*Features extracted from the ECG traces.*
