**4.5 Results**

*Sports Science and Human Health - Different Approaches*

dataset using the moving-average filter.

in real time.

was 10,500.

extracted.

• Mean • Variance • Skewness • Kurtosis

**4.3 Feature extraction**

**4.4 Training process**

(FPR), F1 score, and accuracy.

• Coefficient of variance

*Features extracted from the ECG traces.*

**Time domain features Frequency domain** 

**features**

• Spectral flux • Spectral entropy • Spectral flatness

**4.2 Preprocessing**

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

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

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

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

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

**Time-frequency domain features**

b. Spectrogram (SPEC)

• Combines all the prementioned features • Use quadratic time-frequency distribution (QTFD) to find joint (t, f) representation: a. Winger-Ville distribution (WVD)

c. Extended modified B-distribution (EMBD)

**84**

**Table 2.**

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 for the extended modified B distribution.

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.


#### **Table 3.**

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


#### **Table 4.**

*Evaluation parameters in classifying ST elevation.*


**Table 5.**

*Evaluation parameters in classifying T-wave inversion.*

## **5. Real-time smart-digital stethoscope system**

Different methods can be used to detect cardiovascular diseases (CVD) including electrocardiogram (ECG), magnetic resonance imaging (MRI), and echocardiogram (echo). ECG is considered the most popular method because it provides an inexpensive, non-invasive, and intuitive method for heart diagnosis. However, it has a limitation when it comes to detecting structural abnormalities and defects in heart valves due to heart murmurs [13]. The previously mentioned technologies for diagnosing cardiovascular diseases could be unaffordable by the majority of the people in low-income countries to detect the CVD in advance [14–16]. Heart sound (HS) has been one of the most primitive and popular methods of detecting early cardiac illnesses with the help of abnormal heart sounds. Phonocardiogram (PCG), also known as heart sound (HS), is a graphical representation of the HS recording signals using an equipment called as phonocardiograph [17, 18]. There are three major limitations of the auscultation of the heart: first, the recorded sounds have very low amplitude which will require the device to be extremely sensitive. Second, the low-amplitude HS signal can be easily corrupted by noise leading to a faulty diagnosis. Finally, the reliability of the auscultation technique mainly depends on the skill, expertise, and capability of hearing of the doctor. Machine learning could be a solution to this problem.

The heart produces HS due to the closure of heart valves that produces the normal heart sounds. Mitral and tricuspid valve closure produces the first heart sound ("S1"), and aortic and pulmonic valve closure produces the second heart sound ("S2") (**Figure 14**). There is no heart sound observed for normal opening of heart valve. Moreover, the flow of blood from one structure inside heart to another typically does not produce any sound. Abnormal heart sounds are caused due to the problems in heart valves or muscles or both. The third HS (S3) (**Figure 14**) is normally caused by a sudden reduction of blood supply from the left atrium to the ventricle, which is normal for children and adults (35–40 years). However, in other age groups and especially in the people above 40 years, it is abnormal [19]. The failure of heart in the diastolic period can be linked to the fourth heart sound as illustrated in **Figure 13**. Heart sounds can be categorized in terms of frequency as they differ from each other in frequency. The frequency of S1 is smaller than S2. The low-amplitude abnormal heart sounds S3, and S4 typically occurs 0.1–0.2 s after S2 and about 0.07–0.1 s before S1 respectively [19]. S1 and S2 sounds are high-amplitude signals and well identified by the diaphragm of the stethoscope. The frequency ranges of S1 and S2 are 50–60 and 80–90 Hz, respectively [19]. S3 is a low-amplitude signal with a bandwidth of 20–30 Hz [19]. S4 typically occurs at the end of diastole and can be identified easily by stethoscope, and the frequency is below 20 Hz [19]. A detailed review and state-of-the-art techniques of HS processing and classification

**87**

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

classification were discussed.

normal than abnormal readings.

be seen in **Figure 16**.

**5.1 Wearable system**

**Figure 14.**

*Different heart sounds.*

MATLAB.

are discussed in [20–22]. The abnormal characteristics of the HS signal were stated in [23], while the different signal processing techniques involved in the HS signal analysis are discussed in [24]. In [25], recent works related to feature selection and

The proposed system consists of two subsystems: the two systems communicate wirelessly via BLE technology as shown in **Figure 15**, details of which are found in [26, 27]. The sensor subsystem consists of the acoustic sensor that acquires the heart sound signal and feeds to analog front end. A custom sensor was designed and implemented on a traditional stethoscope chest piece to amplify the heart sound waveform. The sensor bandwidth is 20–600 Hz to perform the conversion of the heart sound to electrical signal; the microphone was placed in the rubber tube very close to the chest piece as shown in **Figure 16**. The signal is then pre-amplified and filtered. After that, the signal is converted by ADC in the RFduino microcontroller and transmitted wirelessly into an intelligent detection subsystem that consists of personal computer (PC) where the signal will be processed and classified using

In this system, a dataset from PhysioNet challenge 2016 was utilized, which includes 3126 heart sound recordings divided into five databases (A through E); each record lasted from 5 s to just over 120 s. These HS data were recorded from clinical and nonclinical environment from both healthy and pathological patients (e.g., children and adults) from four different locations—aortic, pulmonic, tricuspid, and mitral areas. The dataset includes normal and abnormal recordings with a higher number of

The brain of the whole system is the intelligent abnormal heart sound and warning subsystem. It is comprised of three modules: data acquisition and logging, Bluetooth module, and classification. This subsystem acquires real-time HS signals and detects the abnormality of the signal using trained ML algorithm. Normal and abnormal heart sound data from a public database were used for training and testing of the machine learning algorithm in the MATLAB environment. The best performing algorithm was identified and ported in Python 3.5 to be used as a real-time classifier in the testing phase. The detailed block diagram of the machine learning approach can

The HS data were preprocessed and segmented into training and testing data. The algorithm to classify MI, the support vector machine (SVM) algorithm, was implemented initially using MATLAB 2018a and later on using Python 3.5 in personal computer (PC) platform for real-time classification. Signal preprocessing was accomplished using the signal processing toolbox, and training and classification

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

**Figure 14.** *Different heart sounds.*

*Sports Science and Human Health - Different Approaches*

**5. Real-time smart-digital stethoscope system**

*Evaluation parameters in classifying T-wave inversion.*

be a solution to this problem.

**Table 5.**

Different methods can be used to detect cardiovascular diseases (CVD) including electrocardiogram (ECG), magnetic resonance imaging (MRI), and echocardiogram (echo). ECG is considered the most popular method because it provides an inexpensive, non-invasive, and intuitive method for heart diagnosis. However, it has a limitation when it comes to detecting structural abnormalities and defects in heart valves due to heart murmurs [13]. The previously mentioned technologies for diagnosing cardiovascular diseases could be unaffordable by the majority of the people in low-income countries to detect the CVD in advance [14–16]. Heart sound (HS) has been one of the most primitive and popular methods of detecting early cardiac illnesses with the help of abnormal heart sounds. Phonocardiogram (PCG), also known as heart sound (HS), is a graphical representation of the HS recording signals using an equipment called as phonocardiograph [17, 18]. There are three major limitations of the auscultation of the heart: first, the recorded sounds have very low amplitude which will require the device to be extremely sensitive. Second, the low-amplitude HS signal can be easily corrupted by noise leading to a faulty diagnosis. Finally, the reliability of the auscultation technique mainly depends on the skill, expertise, and capability of hearing of the doctor. Machine learning could

**Parameters/ML algorithms WVD SPEC EMBD**

Recall (TPR) (%) 86 84 83 84 98.5 96.9 FPR (%) 19 20 22 21 1.3 4.3 Precision (%) 81 80 78 79 97.8 95.7 F score (%) 83.4 82.7 75.9 76.2 98.2 96.6 Accuracy (%) 78 76.3\* 72.1 74 96.3 95.1

**SVM KNN SVM KNN SVM KNN**

The heart produces HS due to the closure of heart valves that produces the normal heart sounds. Mitral and tricuspid valve closure produces the first heart sound ("S1"), and aortic and pulmonic valve closure produces the second heart sound ("S2") (**Figure 14**). There is no heart sound observed for normal opening of heart valve. Moreover, the flow of blood from one structure inside heart to another typically does not produce any sound. Abnormal heart sounds are caused due to the problems in heart valves or muscles or both. The third HS (S3) (**Figure 14**) is normally caused by a sudden reduction of blood supply from the left atrium to the ventricle, which is normal for children and adults (35–40 years). However, in other age groups and especially in the people above 40 years, it is abnormal [19]. The failure of heart in the diastolic period can be linked to the fourth heart sound as illustrated in **Figure 13**. Heart sounds can be categorized in terms of frequency as they differ from each other in frequency. The frequency of S1 is smaller than S2. The low-amplitude abnormal heart sounds S3, and S4 typically occurs 0.1–0.2 s after S2 and about 0.07–0.1 s before S1 respectively [19]. S1 and S2 sounds are high-amplitude signals and well identified by the diaphragm of the stethoscope. The frequency ranges of S1 and S2 are 50–60 and 80–90 Hz, respectively [19]. S3 is a low-amplitude signal with a bandwidth of 20–30 Hz [19]. S4 typically occurs at the end of diastole and can be identified easily by stethoscope, and the frequency is below 20 Hz [19]. A detailed review and state-of-the-art techniques of HS processing and classification

**86**

are discussed in [20–22]. The abnormal characteristics of the HS signal were stated in [23], while the different signal processing techniques involved in the HS signal analysis are discussed in [24]. In [25], recent works related to feature selection and classification were discussed.

### **5.1 Wearable system**

The proposed system consists of two subsystems: the two systems communicate wirelessly via BLE technology as shown in **Figure 15**, details of which are found in [26, 27]. The sensor subsystem consists of the acoustic sensor that acquires the heart sound signal and feeds to analog front end. A custom sensor was designed and implemented on a traditional stethoscope chest piece to amplify the heart sound waveform. The sensor bandwidth is 20–600 Hz to perform the conversion of the heart sound to electrical signal; the microphone was placed in the rubber tube very close to the chest piece as shown in **Figure 16**. The signal is then pre-amplified and filtered. After that, the signal is converted by ADC in the RFduino microcontroller and transmitted wirelessly into an intelligent detection subsystem that consists of personal computer (PC) where the signal will be processed and classified using MATLAB.

In this system, a dataset from PhysioNet challenge 2016 was utilized, which includes 3126 heart sound recordings divided into five databases (A through E); each record lasted from 5 s to just over 120 s. These HS data were recorded from clinical and nonclinical environment from both healthy and pathological patients (e.g., children and adults) from four different locations—aortic, pulmonic, tricuspid, and mitral areas. The dataset includes normal and abnormal recordings with a higher number of normal than abnormal readings.

The brain of the whole system is the intelligent abnormal heart sound and warning subsystem. It is comprised of three modules: data acquisition and logging, Bluetooth module, and classification. This subsystem acquires real-time HS signals and detects the abnormality of the signal using trained ML algorithm. Normal and abnormal heart sound data from a public database were used for training and testing of the machine learning algorithm in the MATLAB environment. The best performing algorithm was identified and ported in Python 3.5 to be used as a real-time classifier in the testing phase. The detailed block diagram of the machine learning approach can be seen in **Figure 16**.

The HS data were preprocessed and segmented into training and testing data. The algorithm to classify MI, the support vector machine (SVM) algorithm, was implemented initially using MATLAB 2018a and later on using Python 3.5 in personal computer (PC) platform for real-time classification. Signal preprocessing was accomplished using the signal processing toolbox, and training and classification

#### **Figure 15.**

*System overall with modified stethoscope chest.*

#### **Figure 16.**

*Blocks of the machine learning-based abnormality detection algorithm.*

were done by Statistics and Machine Learning Toolbox in the MATLAB and using Numpy (v1.13.3), Matplotlib (v3.0.2), PyBrain (v0.31), and Scikit learn (v0.20) libraries in Python.
