Research Article

Robust and Accurate Anomaly Detection in ECG Artifacts Using Time Series Motif Discovery

Algorithm 2

Robust anomaly detection.
Input: ECG in lead ,
     : The starting position of P-wave of th beat,
     : The end position of P-wave of th beat,
      : The position of Q point of th beat,
     : The end position of T-wave of th beat,
numberofbeat: The number of R
cananomaly: Anomaly candidates from the cleanest lead.
Output: All anomaly beats
(1) For to numberofBeat  //Begins beat extraction
(2)   = Extract()  //P-wave of th beat
(3)   = Extract()  //PR segment of th beat
(4)   = Extract()  //QT interval of th beat
(5) End
(6) For to numberofBeat
(7)  nearestneighbordis = infinity
(8)  For to numberofBeat
(9)   If !=
(10)    distance = DTW(, ) +
(11)        DTW(, ) +
(12)        DTW(, )
(13)    If distance < nearestneighbordis[]
(14)     nearestneighbordis[] = distance
(15)    End
(16)   End
(17)  End
(18) End
(19) newanomaly = Find (nearestneighbordis > thres)
(20) anomalybeats = Merge_answer(Shift(cananomaly), newanomaly)
(21) Return anomalybeats