Memuat
Memuat
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Class Classifying EKG Arrhythmia with Wavelet Deep Learning #2: Filter Noise, Beat/EPOCH Segmentation, and Normalization”.
Other ways we can help with Python.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Multi-Objective Optimization Course: NSGA-II, MOPSO & Hybrid Algorithms (Python)

ECG Arrhythmia Classification Course with Wavelet & Deep Learning (PyTorch)

ANFIS + PSO/GA Course for Non-Linear Time Series Forecasting (Python)
Have it built for you
No time to learn Python? Our team can do the project for you.

Python Machine Learning — Prediction Models, Customer Segmentation, Fraud Detection & AI Apps

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
Here is the final result, a clean EKG signal free from Baseline Wander, and over 100,000 bits that have been cut, normalized, and enriched with RR interval features. We also found that the arrhythmia bits come faster than usual. Let's get started. Hello, welcome to episode two of the EKG classification series with WaveLat and Deep Learning. The EKG signal is very noisy, with a fluctuating baseline due to breathing, electrical noise, and muscle noise. For per-bit classification, the signal also needs to be cut around each beat. Today we are building this preprocessing stage.
Create a preprocessing underscore ek.py file. The filter function uses a Butterworth Order 3 filter with a frequency range of 0.5 to 40 Hz. Below 0.5 Hz is Baseline Wander, above 40 Hz is muscle and electrical noise. We use Field-Field, a forward and backward filter, to avoid phase shift that would distort the waveform. The segmentation function cuts 250 samples around each R peak, 90 before and 160 after, then resamples to 125 samples and normalizes each bit using Z-score normalization. The RR feature includes the distance to the previous bit, the distance to the next bit, the average of the last 10 RR intervals, and the ratio of the previous RR to the local average.
The dataset building function runs segmentation for the list of recordings and combines the results, while recording the patient number for each bit.
Create a buat underscore bit.py file and run it. 44 recordings are segmented in seconds, producing 50,984 bits DS1 and 49,677 bits DS2, saved to bit midb.npz. The ratio of the previous RR to the local average is very informative, the average N bit is 1.03, while the S bit is 0.83 and V is 0.77 That means the arrhythmia bit comes earlier. That's why it's called a premature bit. Let's look at the graph.
The raw signal wobbles up and down, while after the bandpass filter, the baseline is flat and the P wave shape is preserved, QRS, T wave remains intact. Normalized example bits show the differences in shape among the four classes. The box plot of RR ratio shows S and V clearly below 1, while F is close to N, so F will be difficult to distinguish.
Done. We have filtered the signal with a phase-shifted bandpass filter, cut the bit around the R peak, normalized it, and calculated the RR feature. In the next episode, we will extract the wave-flat feature and create a scalogram. Currently working on a thesis, dissertation, or research in the field of biomedical engineering and artificial intelligence? Cerdas Inovasi Digital helps implement biomedical signal processing, from EKG filtering and segmentation, wave-flat transformation, classic machine learning, up to 1D and 2D CNNs along with their interpretations, as well as opening Python programming courses for electrical and biomedical engineering. Want to master the entire series? From MITBIH baseline data to class-wise arrhythmia evaluation? All 6 episodes, complete with step-by-step PDF guides, dataset, and source code, available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or one-time payment of Rp999.000 for lifetime access. Want just one class? Buy the single class with lifetime access. Subscribe now at the premium page cerdasinovasidigital.com Contact our WhatsApp, or visit cerdasinovasidigital.com Thank you for watching, see you in the next episode.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →