Systems and Control Theory Lecture Notes
Laura Giarr´ e
Lesson 23: Regularized LMS methods for baseline wandering removal in wearable ECG devices
Regularized LMS method
Baseline wandering removal
Wearable ECG devices
Detrend of Economic Data
L. Giarr´e- Systems and Control Theory 2017-2018 - 2
Outline & Goal
Introduction
Outline & Goal
Introduction
Quadratic Regularization 1 and 2 methods
L. Giarr´e- Systems and Control Theory 2017-2018 - 3
Outline & Goal
Introduction
Quadratic Regularization 1 and 2 methods
LMS methods
Outline & Goal
Introduction
Quadratic Regularization 1 and 2 methods
LMS methods
Numerical and experimental results
L. Giarr´e- Systems and Control Theory 2017-2018 - 3
Introduction
Wearable electrocardiogram (ECG) devices are light-weight, low-consumption systems
used to acquire and transmit (with wireless connection) physiological signals.
Baseline wandering (BW): patient movements and
respiration produce a low–frequency (up to 0.8 Hz) random variation of the ECG signal trend.
Removing this artifact is not simple since its spectrum is
partly overlapped to the informative signal.
State of the art on baseline removal
Several methods and tools for solving the baseline wandering problem
1. based on notch filters and time-varying filters [AS85], [Sorn1993]
L. Giarr´e- Systems and Control Theory 2017-2018 - 5
State of the art on baseline removal
Several methods and tools for solving the baseline wandering problem
1. based on notch filters and time-varying filters [AS85], [Sorn1993]
2. linear spline and cubic approximations [Meyer1977],[Papa2001]
State of the art on baseline removal
Several methods and tools for solving the baseline wandering problem
1. based on notch filters and time-varying filters [AS85], [Sorn1993]
2. linear spline and cubic approximations [Meyer1977],[Papa2001]
3. adaptive filters [Lagu1992],
L. Giarr´e- Systems and Control Theory 2017-2018 - 5
State of the art on baseline removal
Several methods and tools for solving the baseline wandering problem
1. based on notch filters and time-varying filters [AS85], [Sorn1993]
2. linear spline and cubic approximations [Meyer1977],[Papa2001]
3. adaptive filters [Lagu1992],
4. discrete wavelet transform (DWT) [Park1998]
State of the art on baseline removal
Several methods and tools for solving the baseline wandering problem
1. based on notch filters and time-varying filters [AS85], [Sorn1993]
2. linear spline and cubic approximations [Meyer1977],[Papa2001]
3. adaptive filters [Lagu1992],
4. discrete wavelet transform (DWT) [Park1998]
5. empirical mode decomposition (EMD) [Blan2008]
L. Giarr´e- Systems and Control Theory 2017-2018 - 5
State of the art on baseline removal
Several methods and tools for solving the baseline wandering problem
1. based on notch filters and time-varying filters [AS85], [Sorn1993]
2. linear spline and cubic approximations [Meyer1977],[Papa2001]
3. adaptive filters [Lagu1992],
4. discrete wavelet transform (DWT) [Park1998]
5. empirical mode decomposition (EMD) [Blan2008]
6. quadratic variation reduction (QVR) and a linear time
invariant (LTI) implementation approximating the QVR
method [Fasa2013]
Our contribution: Novelty
Online implementations: a new baseline sample is estimated after the acquisition of a new ECG sample.
Generalized cost function to be optimized, including an either
1 or 2 penalty term.
L. Giarr´e- Systems and Control Theory 2017-2018 - 6
State of the art on regularization and Detrending
Regularization using the 1 -norm has attracted a lot of interest 1. in statistics [Tib1985]
2. signal processing [Chen01]
3. machine learning [Boyd04]
Our target:regularized mean square error
Let y [k], k = 1, 2, . . . , n, be the acquired ECG signal affected by a baseline q [k], k = 1, 2, . . . , n.
q is a lowpass signal that introduces slow variations (or trend) into the ECG.
The objective of a BW removal algorithm is that of estimating q from y and remove it, so that y − q has the same shape of y and a constant trend.
L. Giarr´e- Systems and Control Theory 2017-2018 - 8
Regularized mean square error
Consider the following penalized mean square error problem to estimate the baseline:
ˆq = arg min
q J (q)
= arg min
q y − q 2 2 + λP(q), (1)
where y and q are n-length column vectors, · 2 is the 2 norm of
a vector, and λ is a given positive constant.
Regularized mean square error
The first term is a fidelity term between the acquired ECG signal and the unknown baseline.
The penalty term P(q) must be chosen in order to induce smoothness on the signal q:
P
2(q) = Δq 2 2 (2)
P
1(q) = Δ 2 q 1 , (3)
where Δ = 1 − z −1 is the derivative operator (with z −1 denoting the unitary delay).
L. Giarr´e- Systems and Control Theory 2017-2018 - 10
ARMA modeling of BW
We obtain the baseline q from the observed ECG signal y as an ARMA model:
Q (z) = F (z)Y (z) = B (z)
A (z) Y (z)
B (z) =
M k =0
b k z −k ,
A (z) = 1 +
N k =1
a k z −k ,
with b k , k = 0, 1, . . . , M, and a k , k = 1, . . . , N, the MA and
ARMA modeling of BW
Thus, the baseline is given by
q [n] =
M k =0
b k x [n − k] −
N k =1
a k q [n − k]
= ϕ T 1 [n]θ,
where
ϕ 1 [n] =
y [n] . . . y[n − M] q[n − 1] . . . q[n − N] T
θ =
b 0 . . . b M a 1 . . . a N T
,
L. Giarr´e- Systems and Control Theory 2017-2018 - 12
Cost function
J
2(q) = y − ϕ T 1 θ 2 2 + λϕ T 2 θ 2 2
J
1(q) = y − ϕ T 1 θ 2 2 + λϕ T 2 θ 1
Penalty P
2(q)
Let h = [1 − 1] T , so that
Δq = h T
q [n]
q [n − 1]
= h T
ϕ T 1 [n]
ϕ T 1 [n − 1]
θ
= ϕ T 2 [n]θ where
ϕ 2 [n] =
ϕ 1 [n] ϕ 1 [n − 1] h .
L. Giarr´e- Systems and Control Theory 2017-2018 - 14
Penalty P
1(q)
Δ 2 q = h T
⎡
⎣ q [n]
q [n − 1]
q [n − 2]
⎤
⎦
= h T
⎡
⎣ ϕ T 1 [n]
ϕ T 1 [n − 1]
ϕ T 1 [n − 2]
⎤
⎦ θ
= ϕ T 2 [n]θ, ϕ 2 [n] =
ϕ 1 [n] ϕ 1 [n − 1] ϕ 1 [n − 2]
h .
LMS Algorithms for 2 -penalty
Defining
x [k] =
y [k] 0 T
; ϕ[k] =
ϕ 1 [k] √
λϕ 2 [k] e [k] = x[k] − ϕ T [k]θ.
The LMS solution is given by
ˆθ[n] = ˆθ[n − 1] − μ
2 ∇e[n] 2
μ is the updating gain
The LMS update is
ˆθ[n] = ˆθ[n − 1] + μϕ[n]e[n]
L. Giarr´e- Systems and Control Theory 2017-2018 - 16
LMS Algorithms for 1 -penalty
Approximating the subdifferential of the 1 -norm at ϕ T 2 θ as
∇|ϕ T 2 θ| 1 ≈ ϕ T 2 sign(ϕ T 2 θ)
The LMS solution is
ˆθ[n] = ˆθ[n − 1] − μ
2 ∇J
1[n]
where μ is the updating gain
The LMS update is ˆθ[n] = ˆθ[n − 1] + μ
ϕ 1 [n]e[n] − 1
2 ϕ T 2 [n]sign(ϕ T 2 [n]ˆθ[n − 1])
Numerical Results: Triangular wave
3000 3500 4000 4500 5000 5500 6000
samples -5
-4 -3 -2 -1 0 1 2 3 4 5
y,q
y=x+q q
L. Giarr´e- Systems and Control Theory 2017-2018 - 18
Numerical Results: Triangular wave
3000 3500 4000 4500 5000 5500 6000
samples -3
-2 -1 0 1 2 3
q
q LMS2 LMS1
MSE values
Since the trend is known, the methods can be compared in terms of mean square error (MSE):
MSE = 1 N q
n
(q[n] − ˆq[n]) 2
Table: MSE values (averaged over 50 realizations of the trend).
LMS-L2 LMS-L1 0.0045 0.0037
L. Giarr´e- Systems and Control Theory 2017-2018 - 20
Numerical Results: Synthetic ECG
The algorithm to generate synthetic baseline-free ECG
signalsis is a Matlab implementation of the one in PhysioNet.
We set the heart rate to 60 bpm, with a sampling frequency f s = 256 Hz and an additive Gaussian noise with standard deviation σ n = 0.01.
The output is an ECG-like signal normalized between -0.4 and 1.2 mV.
A synthetic pseudo-random baseline was added to the ECG signal.
The baseline is a filtered white Gaussian process with a
fourth-order Butterworth filter with a 3-dB cutoff frequency
set to f .
Numerical Results: Synthetic ECG
L. Giarr´e- Systems and Control Theory 2017-2018 - 22
MSE values
Table: MSE values (averaged over 50 realizations of the trend).
Method f t = 0.2 Hz f t = 0.4 Hz f t = 0.6 Hz
QVR-LTI 0.0105 0.0293 0.0567
LMS-L2 0.0162 0.0268 0.0372
LMS-L1 0.0220 0.0310 0.0360
Experimental Results: REAL ECG data
L. Giarr´e- Systems and Control Theory 2017-2018 - 24
Prototype
A prototype of ECG acquisition device was developed at the UNIFI laboratory. Features:
acquisition of 3 ECG bipolar derivations (DI, DII, DIII) and 1 pre-cordial derivation (V1), by using 5 standard electrodes;
analog front-end and ADC at 24 bit (Texas Instruments ADS1293), sampling frequency up to 25.6 ksps;
micro-controller ARM STM32F411;
storage onto microSD;
transmission of ECG signals in real time by means of wireless Bluetooth 4.0 Low Energy (Nordic Semiconductor nRF8001) or by means of USB connection (developed dedicated APP using HL7 FHIR standard;
PCB dimension of 44x60 mm; long duration battery with
Experimental Results: REAL ECG data
Figure: Prototype of ECG acquisition device.
L. Giarr´e- Systems and Control Theory 2017-2018 - 26
Economic data Results
We apply the developed methods also to financial time series trend estimation
Here, the trend is just the information we would like to extract from the observed data for economic analysis purposes.
Data are taken daily on a 10 years interval (from September
29th, 2006 to October 3rd, 2016).
Results obtained from the SP500 dataset
We plot the estimated trends obtained by using the RLS-12, LMS-12 and HP algorithms as well as the real data.
These results were obtained by setting the order of the
derivatives d 1 = 1 and d 2 = 2, λ 1 = 50, λ 2 = 100, μ = 10 −8
The ARMA model was identified with M = 3 and N = 1.
L. Giarr´e- Systems and Control Theory 2017-2018 - 28
Economic real data (Standard&Poor)
2011 2012 2013 2014
1000 1100 1200 1300 1400 1500 1600 1700 1800
SP500 RLS-12 LMS-12 HP
Figure: Real SP500 data and estimated trends with different methods.
More work
New mixed norm cost (Penalty cost with both 1 and 2 )
RLS Solution
L. Giarr´e- Systems and Control Theory 2017-2018 - 30
Publications
Adaptive quadratic regularization for baseline wandering removal in wearable ECG devices, Eusipco 2016
Regularized LMS methods for baseline wandering removal in wearable ECG devices, CDC 2016
Mixed 2 and 1 -norm regularization for adaptive detrending
with ARMA modeling, Journal of Franklin Institute, 2017
References on baseline removal
AS85 J. V. Alste and T. Schilder, “Removal of base-line wander and power-line interference from the ECG by an efficient FIR filter with a reduced number of taps,” IEEE Transactions on Biomedical Engineering, vol.
BME-32, no. 12, pp. 1052–1060, Dec 1985
Sorn1993 L. Sornmo, “Time-varying digital filtering of ECG baseline wander,” Medical and Biological Engineering and Computing, vol. 31, no. 5, pp. 503–508, 1993.
Meyer1977 C. R. Meyer and H. N. Keiser, “Electrocardiogram baseline noise estimation and removal using cubic splines and state-space computation techniques,” Computers and Biomedical Research, vol. 10, no. 5, pp.
459–470, 1977.
Papa2001 C. Papaloukas, D. I. Fotiadis, A. P. Liavas, A. Likas, and L. K. Michalis, “A knowledge-based technique for automated detection of ischaemic episodes in long duration electrocardiograms,” Medical and Biological Engineering and Computing, vol. 39, no. 1, pp. 105–112, 2001.
Lagu1992 P. Laguna, R. Jan´e, and P. Caminal, “Adaptive filtering of ECG baseline wander,” in 14th Annual
International Conference of the IEEE Engineering in Medicine and Biology Society, vol. 2, Oct 1992, pp.
508–509.
Park1998 K. L. Park, K. J. Lee, and H. R. Yoon, “Application of a wavelet adaptive filter to minimise distortion of the ST-segment,” Medical and Biological Engineering and Computing, vol. 36, no. 5, pp. 581–586, 1998.
Blan2008 M. Blanco-Velasco, B. Weng, and K. E. Barner, “ECG signal denoising and baseline wander correction based on the empirical mode decomposition,” Computers in Biology and Medicine, vol. 38, no. 1, pp.
1–13, 2008.
Fasa2013b A. Fasano and V. Villani, “Baseline wander removal in ECG and AHA recommendations,” in Computing in Cardiology Conference (CinC), 2013, Sept 2013, pp. 1171–1174.
L. Giarr´e- Systems and Control Theory 2017-2018 - 32
References on regularized penalty and de-trending
tib1985 R. Tibshirani, “Regression shrinkage and selection via the lasso,” Journal of the Royal Statistical Society, vol. 58, no. 1, p. 267âĂŞ288, 1996.
chen01 S. Chen, D. Donoho, and M. Saunders, “Atomic decomposition by basis pursuit,” SIAM Review, vol. 43, no. 1, p. 129âĂŞ159, 2001.
boyd04 S. Boyd and L. Vandenberghe, Convex optimization Cambridge Univ. Press, 2004.