=Paper= {{Paper |id=Vol-2608/paper71 |storemode=property |title=Physiological signals analysis, recognition and classification using machine learning algorithms |pdfUrl=https://ceur-ws.org/Vol-2608/paper71.pdf |volume=Vol-2608 |authors=Iurii Krak,Anatolii Pashko,Oleg Khorozov,Oleg Stelia |dblpUrl=https://dblp.org/rec/conf/cmis/KrakPKS20 }} ==Physiological signals analysis, recognition and classification using machine learning algorithms== https://ceur-ws.org/Vol-2608/paper71.pdf
         Physiological Signals Analysis, Recognition and
        Classification Using Machine Learning Algorithms

              Iurii Krak1,2 [0000-0002-8043-0785], Anatolii Pashko1[0000-0001-6944-8477],
               Oleg Khorozov2[0000-0001-8812-323X] , Oleg Stelia1[0000-0002-1453-501X]
    1
     Taras Shevchenko National University of Kyiv, 64/13 Volodymyrska str., 01601, Ukraine
         yuri.krak@gmail.com, aap2011@ukr.net, oleg.stelya@gmail.com
           2
             Glushkov Cybernetics Institute, Kyiv, 40 Glushkov avenue, 03187, Ukraine
                                   oleh753@hotmail.com




         Abstract. The spatial and time-frequency domain features analysis are major
         approaches for signal classification. For non-stationary signals classification,
         the selection of features is paramount to the robustness of the recognition sys-
         tems. Among machine learning algorithms, convolutional neural networks
         (CNNs) have achieved significant performance in many pattern recognition
         tasks, along with traditional approaches such as Random Forest or Gradient
         Boosting. Wavelet transformations allow utilizing spectral components that are
         useful in signal processing tasks. The performance of the wavelet applications
         for signal classification was evaluated. The experiments show that wavelet
         transformations can achieve better accuracy than existing algorithms while hav-
         ing significantly fewer parameters than conventional CNNs.

         Keywords: machine learning, classification, signal analysis, expert systems,
         wavelet transformation


1        Introduction
     The primary diagnosis of cardiovascular disease involves expert systems based
on the rules of solving medical problems. Rule-based Expert systems are inefficient
using big data because they are hard to scale in the presence of new data. Therefore,
automating data analysis and recognition procedures is required.
    Electrocardiography (ECG) as a non-invasive method for diagnosing the cardio-
vascular system, involves the identification of morphological features characterizing
the types of a heart disability. The data getting from patients monitoring potentially
contain a lot of information used inefficiently due to the heterogeneous data structure,
which is difficult to interpret. One solution is to use a deep learning model to classify
the type of arrhythmia along with the choice of cardiac cycle characteristics.
    The deep learning architecture model with the wavelet convolutional layer for sig-
nals classification is presented in this work. The reliability of the results verified on
the basis of the ECG database, which was used to evaluate the effectiveness of the
pro-posed method. The article proposes to automate the process of features selected
  Copyright © 2020 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
from the time-frequency domain for ECG signals online classification using machine
learning models. ECG signals from mobile devices can be using for person authenti-
cation in remote healthcare systems [1, 2]. The purpose is to recognize the cardiovas-
cular disease and estimate the accuracy of predictions using deep learning methods
for ECG signals classification. A software framework that facilitate integration of the
mathematical models and computer simulations make it possible to efficiently classify
and predict the status of patients. The proposing solution is to use the wavelet convo-
lutional layer for feature extractors and the neural network are used for making a final
decision.
    Most biological systems reflect their normal or abnormal processes by
nonstationary signals and thus joint time-frequency analysis of the physiological
signals has potential applications.


2      ECG signals analysis using wavelet transformations
     The ECG signals contain many artifacts that need to be filtered. The main sources
of ECG noise are baseline deviation (breathing bias), muscle activity (contraction),
poor electrode contact, and high-frequency network interference from equipment.
Baseline wander elimination is considered as a classical problem in ECG signal
filtering during data collection. The ECG data cleaning step is necessary since a
signal with noise reduces the accuracy of diagnosis. The wide variety of ECG signals
waveforms. The purpose of signal processing is to eliminate low-frequency drift of
the signal baseline and high-frequency noise. Many studies have developed linear or
non-linear filters to remove additive noise and interference, such as moving averaging
filters, low-pass filters, band-pass filters, non-linear filters and Savitsky-Golea
smoothing filters. Wavelet-based noise removal methods are connected by wavelet
coefficients for filtering high-frequency noise and baseline drift effects [3].
     To analyse and verify the reliability of the results, the PhysioNet ECG dataset [4]
was used, which contains ECG measurements for individuals labelled Normal Sinus
Rhythm (NSR) and those with arrhythmia (ARR) or congestive heart failure (CHF).
This data set contains 96 ARR, 36 NSR and 30 CHF records, which were used to
evaluate the effectiveness of the proposed method. Based on ECG data, a
classification over three groups of people with different pathologies: cardiac
arrhythmia, congestive heart failure and healthy people was made.


 2.1 ECG signals analysis using discrete wavelet transformations
    The wavelet transform is used to analyse data, search for similarity in time series,
classify and cluster time series, identify anomalies in the behaviour of time series.
   Discrete wavelet transform operates with discrete parameter values. The basis of
space are defined as
                                          m
                          m,k                         m, k  Z,
                                 (t )  a 2  a m t  k ,

where t - parent wavelet.
    For practical use, there are convenient wavelets built on the basis of Gauss func-
tion and its derivatives. They have the best localization in both the time and frequency
domains.
    The value of a can be arbitrary, as a rule, use a  2 . In this case, the transform is
called the dyadic wavelet transform. Forward wavelet coefficients:
                                                 
                                   Wm, k   s(t ) m, k (t )dt,
                                                
s(t ) - continuous signal.
                                                                                                    
   The inverse discrete wavelet transform has the form s(t )                                       Wm,k m,k (t ) .
                                                                                             ь  л  
The number of m - parameter coefficients determines the level of signal decomposi-
tion. For the inverse wavelet transform, use the following representation:
                                                               
                       s(t )   C k  k (t )                   Wm,k m,k (t ),
                                л                 ь л

where Ck - scaling coefficients or approximation coefficients, Wm,k - wavelet coeffi-
cients of signal detail.
   The wavelet analysis algorithm:
   Let a time series be given: s k  s(t k ), k  0,1,...N  1 .
    1. Centre the row and exclude trends.
    2. Assess the variance, evaluate the correlation function.
    3. The values of the coefficients are determined by the formulas.

                                        M a1, b   s k  t k a b j ,
                                                         N 1
                             W ai , b j 
                                                 i   j   k 0                  i        
                                                                           2
                                                  1  t k  b j 
                                       
                                           N 1                                     
                             M a i , b j   exp                                 .
                                           k 0     a i                       
                                                                                   
    4. Discretization of arguments:
                                a i  a min  ia,       i  0,1,...N a  1
                               b j  jb,       j  0,1,...N  1.

   5.    The value of the scalogram density in each node is calculated by the formula:

                                   S (ai , b j )  W ai , b j           2 .
     Theoretical aspects of wavelet transform have been considered in works [5-7], the
use of wavelet transform in vibration studies in works [8-9], identification of systems
[10], fuzzy models [11-12].
     In [13-19] various problems were analyzed when processing signals using wave-
let transform and convolution neural networks.
     Let us applying discrete wavelet transform (DWT) as a filter cascade for ECG
signals.
     A filter bank means dividing a signal into several frequency sub bands for use in
applications. First, we apply a small scale corresponding to high frequencies. Then the
scale increases by a factor of two (frequency decreases by a factor of two) and so on.
We are using «pywt.dwt» library for decomposition signal into frequency bands. The
DWT used to split a signal into different frequency sub-bands, as many as needed.
     If the different types of signals exhibit different frequency characteristics, this dif-
ference should be exhibit in frequency sub-bands. If we generate features from each
of the sub-band, set the collection of features as an input for Logistic Regression,
Random Forest or Gradient Boosting classifiers and train it, the classifier should be
able to distinguish between the different types of signals:


 2.2 ECG signals analysis using continuous wavelet transformations
    The continuous wavelet transform (CWT) of a signal can be using for analysing
content of the signals because they are localized in both frequency and time. They
allows to identify areas where the signal changing frequency content. It is can be use-
ful for identifying signals with low-frequency components or frequency localization
when changing frequency content. The Wavelets are using to localize transients when
changing the content of signals components.
    Wavelet transform provides a general method that can be used to process signals.
Various properties can be calculated and processed using wavelet coefficients. We
can apply the wavelet transform to the ECG signal and convert it to wavelet coeffi-
cients. The coefficients characterize the behaviour of the ECG signal, and the number
of these coefficients is less than the amount of the original signal. This reduction in
feature space is important for recognition and diagnosis.
    A classification algorithm using a wavelet transformation for ECG signals is pro-
posed. The wavelet transform is used to analyse spatial signal and identify anomalies
in the behaviour of time series. The algorithm used morphological filtering and wave-
let transform with a selected mother wavelet. The wavelet coefficients denotes the
correlation between the signal and the wavelet in the given scale and position. The
optimal wavelet should have a shape identical to the signal being analyzed. Continues
wavelet transform is used to evaluate how much a signal resembles a scaled and trans-
lated mother wavelet.
    The wavelet transform of a time-continuous signal x (t ) is defined as:
                                          1              tb
                                                         *
                       CWT ( a , b )           x ( t )    dt ,
                                           a              a 
         *
where  ( t ) is the complex conjugate of wavelet function, a – scale, b - transla-
tion parameters respectively. The function  (t ) compresses or dilates depending on
 a , which enables the CWT to extract the low- and high- frequency components of
 x (t ) . The wavelet scale a characteristic frequency’s of the wavelet such as the spec-
tral peak frequency, pass band centre, and central frequency. The original signal
 x (t ) may be reconstructed using an inverse transform.
                                                                                     fc
    The frequency associated with a wavelet of arbitrary a scale is given by f         ,
                                                                                     a
where the characteristic frequency of the mother wavelet (scale a  1 and location
b  0 ), f c becomes a scaling constant and f is the frequency for the wavelet at arbi-
trary a -scale. The contribution to the signal energy at the specific a scale and b
location is given by the two-dimensional wavelet energy density function known as
the scalogram.
                                S ( a , b )  W a , b  .
                                                       2

    The scalogram can be integrated across a and b to recover the energy in the sig-
nal. The wavelets can be using for analyzing content of the signals because they are
localized in both frequency and time. They allows to identify areas where the signal
changing frequency content. The wavelets are using to localize transients when con-
tent of ECG signals components are changed.


3      Wavelet transform for filtering and analysis ECG signals
       with CNN architecture
We utilize Wavelet transform for filtering and analysis ECG signals with CNN
architecture to develop a predictive model to indicate normal or abnormal behavior. A
signal x (t ) transformed Wavelet into a 2D space, are contained continuous mother
wavelet  (t ) with a - scale factor and b - translation factor.
     The kernel at scales = [3, 4, 5, 6] with Morlet wavelet are plotted (Fig.1).
     The frequency spectrum of ECG signal is in the range from 3 to 45 Hz. Compute
CWT transform using the complex Morlet wavelet and 32 scales between 3Hz and
45Hz. We can get 32 or 64 channels with base line flattening.
     A visualization of the CWT coefficients - 2D scalogram can be used to improve
the distinction between varying types of a signal. To evaluate and analyze a signal
morphology the Morlet wavelet transform was used, as show at the plotter below for
fragment of the ECG signal (Fig.2).
    Let presented the example of the spectrograms segment of the cardiac cycle with a
stride in time every 10 samples with scale 32 wavelet Morlet and Baseline wander
elimination (Fig. 3).
                                    Fig.1. Morlet filters




                            Fig.2. Segment of the cardio signals




                                    Fig. 3. ECG Cycle
     The CWT consists of convolution of filter with the signal. The convolution ker-
nels are defined by means of scales for mother wavelet. A multiscale approximation is
the design method of most of the practically relevant wavelet transforms.
    A time-frequency transform method and convolutional neural network was used as
filtering. This formulation allows us to connect CNN with a multi-resolution analysis.
We use a single-channel data set and wavelet transformation with multiple channels
for using CNNs model.
4      Signal classification based on the continuous wavelet
       transform
A scalogram is the absolute value of the continuous wavelet transform coefficients of a
signal. Since ECG signals are sensitive to noise, studies have been con-ducted by
transforming signals into a frequency domain that is efficient for analysing noisy
signals. The signal transforming from time domain to frequency domain, the 1-D
signal becomes a 2-D matrix, and it could be ana-lysed at multiresolution. This process
makes signal analysis morphologically complex and existing simple classifiers could
perform poorly. We investigate the possibility of using the scalogram as input to
convolutional neural networks, which exhibit optimal performance for the
classification of morphological imagery. When training data is small transfer learning
can be used with pretrained deep models to desision making and prognoses with scale
range 32 wavelet. Time-frequency rep-resentation of the cardiac cycle using Morlet
Wavelets wavelet with 120 scales. A smaller range of scales (32) enables more focus
of abrupt changes in signal and a wide range of scales (64 or 128) provides more
information, which can provide a better classification accuracy.
   Visualization of CWT coefficients allows to distinguish cardiac cycles and QRS
complexes of the ECG signal analysing [11,15]. The scalogram with 128 range of
scales of the cardiac cycle data. The plots of cardiac arrhythmia and normal sinus
rhythm represent below.




                            Fig. 4. Cmor0.5-1.0 ECG_NSR cycle
                            Fig.5 Cmor0.5-1.0 ECG_ARR cycle
   A horizontal characteristic of the scalogram is signal frequency. The scalogram
can be understand as image and apply neural network model to train a classifier. A
model parameters are show in the Table 1. Sequential convolution neural network
model with Trainable parameters: 58,553,203
        num_filter, num_classes = 3, 3
        model = keras.models.Sequential([
           keras.layers.Flatten(input_shape=[fs-1, fs-1, num_filter]),
           keras.layers.Dense(300, activation="relu"),
           keras.layers.Dense(100, activation="relu"),
           keras.layers.Dense(num_classes, activation="softmax")
        ])
        model.compile(loss="sparse_categorical_crossentropy",
                  optimizer="sgd", metrics=["accuracy"])

                                Table 1 Model Parameters.
                Layer (type)          Output Shape         Param
              flatten (Flatten)      (None, 195075)          0
               dense (Dense)           (None, 300)        58522800
              dense_1 (Dense)          (None, 100)         30100
              dense_2 (Dense)           (None, 3)           303
    A ‘Flatten’ layer transforms a two-dimensional matrix of wavelet convolutional
features into a vector that can be fed into a neural network classifier. Training the
ECG data set segments are demonstrated on the Fig.6.
                               Fig.6. ECG signal segments
    After running 10 epochs using a stochastic gradient descent as optimizer, and
computing the loss the accuracy metrics shows a good performance. We got accuracy
of 96% on the ECG dataset. Predicted label (loss: 0.1401 - accuracy: 0.9573). The
results of the investigation are show on the Fig. 7.:




                                 Fig. 7. Confusion matrix
    With a wavelet convolution neural network we get a precise model. With a simple
convolution neural network we were able to get a precise model which quickly allows
us to detect a healthy person from others with heart disease. Based on ECG data a
classification over three groups of patient with cardiac arrhythmia, congestive heart
failure, healthy person was made. Automatic ECGs classification is useful for emer-
gency medicine and remote monitoring as a method of disease identification.
    The Wavelet transform technique allows us to explore the scalogram of non-
stationary signals and then take advantage of image classification techniques.
5      Conclusion
    There are many configurable model of the neural networks configurations that af-
fect the result. Continuous and discrete wavelet transformations are superior to other
non-stationary signal processing methods and classification accuracy.
    The Wavelet transform technique is the most performant if the composite compo-
nents of the signal vary in time. Wavelets transform signals from the time-domain to
the frequency-domain and gives the spectrum. The Wavelet transform technique al-
lows to explore the frequency domain of the non-stationary signals. The results of the
CWT in combination with CNN prove that these approaches are a good choice for the
classification of time series.
    A neural network with wavelet cores is mainly designated for pattern recognition.
Wavelet coefficients are used as input to the network.
    A wavelet network usually consists of a neural network with direct connection,
with one hidden layer and activation functions of which are taken from the wavelet
family. Since wavelet coefficients quite effectively reflect the essence of the signal,
dimensionality reduction can be achieved by wavelet processing.
    Wavelet-neural networks combine the wavelet transform (decomposition-
deconvolution) into one neural networks.

References
1.     Tan, R., Perkowski, M.: Toward Improving Electrocardiogram (ECG) Biometric
       Verification using Mobile Sensors: A Two-Stage Classifier Approach. Published online
       2017 Feb 20. doi: 10.3390/s17020410 (2017)
2.     Hussein, A.F., AlZubaidi, A.K., Al-Bayaty, A., Habash, Q.A.: An IoT Real-Time
       Biometric Authentication System Based on ECG Fiducial Extracted Features Using
       Discrete Cosine Transform. Available from: https://www.researchgate.net/
       publication/319327157. [Accessed: 2020-03-03]
3.     Borries, R.F., Pierluissi, J.H., Nazeran, H.: Wavelet Transform-Based ECG Baseline
       Drift Removal for Body Surface Potential Mapping. Proceedings of the 2005 IEEE.
       DOI: 10.1109/IEMBS.2005.161531. (2005)
4.     Physionet ECG data. https://github.com/mathworks/physionet_ECG_data/ [Accessed:
       2020-03-03]
5.     Daubechies, I.: The wavelet transform, time-frequency localization and signal analysis.
       IEEE Transactions on Information Theory 36(5): 961-1005 (1990)
6.     Baim, D.S., Colucci, W.S., Monrad, E.S., Smith, H.S., Wright, R.F., Lanoue, A.,
       Gauthier, D.F., Ransil, B.J., Grossman, W., Braunwald, E.: Survival of patients with
       severe congestive heart failure treated with oral milrinone. J American College of
       Cardiology 7(3): 661-670 (1986)
7.     Mallat, S.G.: A theory for multi resolution signal decomposition: the wavelet represen-
       tation. IEEE T PAMI 11(7): 674–693 (1989)
8.     Yan, Z., Miyamoto, A., Jiang, Z., Liu, X. An overall theoretical description of
       frequency slice wavelet transform. Mech. Syst. Signal Process. 24(2): 491-507 (2010)
9.     Yan, Z., Miyamoto, A., Jiang, Z.: Frequency slice wavelet transform for transient
       vibration response analysis. Mech. Syst. Signal Process. 23(5): 1474-1489 (2009)
10.    Billings, S. A., Wei, H.-L. A new class of wavelet networks for nonlinear system iden-
       tification. IEEE Transactions on neural networks 16(4): 862-874 (2005)
11.    Stelia, O., Krak, I., Potapenko, L.: Controlled Spline of Third Degree: Approximation
       Properties and Practical Application. In: Lytvynenko V., Babichev S., Wójcik W.,
       Vynokurova O., Vyshemyrskaya S., Radetskaya S. (eds) Lecture Notes in
      Computational Intelligence and Decision Making. ISDMCI 2019. Advances in
      Intelligent Systems and Computing, vol 1020. Springer, Cham, pp.215-224 (2020)
12.   Khorozov, O., Krak, I., Kulias, A., Kasianiuk, V., Wojcik, W., Tergeusizova, A.:
      Monitoring vital signs using fuzzy logic rules. In: Information technology in Medical
      Diagnostics II - - Proceedings of the International Scientific Internet Conference on
      Computer Graphics and Image Processing and 48th International Scientific and
      Practical Conference on Application of Lasers in Medicine and Biology, 2018 CRC
      Press/Balkema. pp. 237–244 (2019)
13.   Nagendra, H. et al.: Application of Wavelet Techniques in ECG Signal Processing: An
      Overview. International Journal of Engineering Science and Technology 3(10): 7432-
      7443 (2011)
14.    Umamaheswara, G.R., Murlidhar, M., Varadarajan, S.: ECG De-noising using im-
      proved thresholding based on Wavelet transforms, International Journal of Advanced
      Computer Science and Network Security 9(9): 221-225 (2009)
15.   Akshay, N., Vamse, N.A., Yeddanapudi, N.D.: ECG noise Removal and QRS complex
      detection using UWT, International Conference on Electrical and Information Engi-
      neering (ICEIE), IEEE vol.2, pp.438-442 (2010)
16.   Zhongyao, Z., Chengyu, L., Yaowei, L., Yixuan, L., Jingyu, W., Lin, B.-S., Jianqing,
      L.: Noise Rejection for Wearable ECGs Using Modified Frequency Slice Wavelet
      Transform and Convolutional Neural Networks. IEEE Access. pp. 1-1.
      10.1109/ACCESS.2019.2900719 (2019)
17.   Yu, S.N., Chen, Y.H.: Electrocardiogram beat classification based on wavelet
      transformation and probabilistic neural network, Pattern Recogn. Lett. 28: 1142–1150
      (2007)
18.   Rai, H.M., Trivedi, Y.H., Shukla, S.: ECG signal processing for abnormalities detection
      using multi-resolution wavelet transform and Artificial Neural Network classifier.
      Measurement 9: 3238-3246 (2013)
19.   Martis, R.J., Acharya, U.R., Min, L.C. ECG beat classification using PCA, LDA, ICA
      and discrete wavelet transform. Biomedical Signal Processing and Control 5: 437-448
      (2013)