top of page

ML Algorithm

In order to understand the data given to us by the EKG arduino board and other EKG generated data, we downloaded the entire MIT-BIH Arrhythmia Database (https://physionet.org/physiobank/database/mitdb/). Since the database is written in WFDB files, we needed to convert the files into CSV files with the same name. This was also because the MIT-BIH Long-Term ECG Database, the database we chose to use for this project, was also in WFDB formatting. Thus the sample 14046.dat, 14046.hea, and 14046.atr would all convert into 14046.csv. 

  • Each row in the generated CSV file corresponds to a singular heartbeat and is generated as follows:

  • The downloaded MIT-BIH record gets split at the R-peaks (The highest spike in the EKG graph) for individual heart beat records. 

  • Each heartbeat record is appended with the first 40 readings of the next heartbeat record so that we include a full QRS Complex. 

    • The QRS complex is the combination of the two downward waves(Q and S) that surround the central wave(R). 

    • The QRS wave shows the depolarization of the right and left ventricles of the heart and contraction of the large ventricular muscles.

  • The heartbeat record gets resamples form 360Hz to 125Hz

  • These records then get normalized into a 0 - 1 range

  • If a heartbeat record is longer than 187 values after normalization, it is discarded

  • Heartbeat records are padded with zeros at the end until they contain exactly 187 values.

  • Heartbeat classifications from the annotations are reduced to just Normal and Abnormal and appended to the end of each heartbeat record (0 is normal, 1 is abnormal). 

    • Each row then contains exactly 188 values.

  • Heartbeat records without classifications are discarded.

The CSV files will now be used to train our ECG model for classification of heartbeats

The purpose of these CSV files is so that they can be used in training your ECG model for classifying heartbeats as either Normal or Abnormal.

Contact

Cewit Building

Navigation

Home

EKG Readings

Our Code

bottom of page