GithubHelp home page GithubHelp logo

mpcnns-a-novel-matrix-profile-cnn-sleep-apnea's Introduction

MPCNN-Sleep-Apnea

We propose MPCNN, a novel feature extraction method for single-lead ECG analysis in apnea classification. Specifically, our approach is inspired by Matrix Profile (MP) algorithms, which utilize fixed-length subsequence distance profiles to capture critical features in the PQRST segment of an ECG signal. We extracted MinDP, MaxDP, and MeanDP values from these distance profiles to serve as inputs for CNN models. We compared this new feature extraction approach with conventional methods, such as R-peaks and RR intervals, in various experiments. Our results demonstrate that our technique has significant potential and efficacy for SA classification, delivering promising per-segment and per-recording performance metrics. First_draft_overall The overall of our proposed SA detecion. (1) Reducing noise and artifacts. (2) Our main contribution in this paper, where we generate a series of subsequences $T_{P_i,m}$, start at a P Peak and spanning a window of length $m$. Subsequently, we calculate the Euclidean distance $d_{i,j}$ to compile a distance profile $D$, from which we extract critical values: $X_{min}$ (MinDP), $X_{max}$ (MaxDP), and $X_{mean}$ (MeanDP). These values serve as inputs for the subsequent modeling stage. (3) Data split in two categories (4) We use some lightweight models to perform the result in per-segment and per-recording classification.

Preparations

Dataset

The data is available at Apnea-ECG Database. Please download and extract the file to dataset.

Downloading dependencies

Python 3.10.12
Keras 2.12.0
TensorFlow 2.12.0

Preprocessing

Please run the file preprocessing.py to extract the data for CNN's input. In our method, we also design ablation study with show as below: window_size

The design of the ablation studys with different window size.

$T_1$: From P peak to the end of ST segment.

$T2$: From P peak to the end of QRS segment.

$T3$: Q peaks to the end of ST segment.

$T4$: QRS segment.

Read the comment in preprocessing.py to get the file data for each situation. $T_1$ is the case that achieved the highest performance. The extracted file has the '.pkl' format.

Deep Learning evaluation

Per-recording classification

After preprocessing, we will test our method using three different deep learning architectures: modified LeNet-5, BAFNet, and SEMSCNN. Please refer to the paper for more information about each model. The performance was evaluated on Google Colab, and the files are in the ".ipynb" format. Change the filename from ".pkl" to test the results for each dataset (from $T_1$ to $T_4$). There are three files including: BAFNET_model.ipynb, LeNet5_model.ipynb, and SE-MSCNN_model.ipynb. Additionally, read the comments in each file to understand how to modify the code to conduct other experiments to test the effectiveness of each term in the feature extraction process of MPCNN: MinDP, MaxDP, and MeanDP (from $M_1$ to $M_7$).

Screenshot 2023-11-12 162043

Per-segment classification

After finishing the per-recording classification and extracting the CSV file, go to test_per_recording.py and enter the name of the '.csv' file as instructed in the comments to obtain the results of the per-segment classification.

Email

If you have any question, please don't hesitate to contact me at [email protected]

mpcnns-a-novel-matrix-profile-cnn-sleep-apnea's People

Contributors

nxhieub avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.