LSTM-FCN for cardiology

栏目: IT技术 · 发布时间: 4年前

LSTM-FCN for cardiology

Long Short Term Memory with Fully Convolutional Network (LSTM-FCN) is an enhancement of FCN, which have been shown to achieve the state-of-the-art performance on the task of classifying time series sequences

Mar 11 ·5min read

LSTM-FCN for cardiology

ECG (source: https://i.ytimg.com/vi/HWzACHkCi3U/maxresdefault.jpg )

We will work on the application of the algorithm on a database containing electrocardiograms (ECG) of 2 different types, and see if this new model can help detect patients at a high risk of sudden death.

LSTM-FCN architecture

LSTM-FCN for cardiology

LSTM-FCN architecture (source: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8141873 )

This algorithm consists of 2 parts: a LSTM block and a FCN part with 3 convolution layers.

LSTM part

Long short-term memory recurrent neural networks are an improvement over the general recurrent neural networks,which possess a vanishing gradient problem. LSTM RNNs address the vanishing gradient problem commonly found in ordinary recurrent neural networks by incorporating gating functions into their state dynamics. For more information about LSTM networks, you can read this great article by Christopher Olah.

In addition to the LSTM block, this part also includes a dimension shuffle. Meanwhile the fully convolutional block views the time series as a univariate time series with multiple time steps, the LSTM block in the proposed architecture receives the input time series as a multivariate time series with a single time step. This is accomplished by the dimension shuffle layer, which transposes the temporal dimension of the time series. A univariate time series of length N, after transformation, will be viewed as a multivariate time series (having N variables) with a single time step. Dimension shuffle improves the efficiency of this model by requiring an order of magnitude less time to train.

FCN part

We use Temporal Convolutional Networks as a feature extraction module in a Fully Convolutional Network (FCN) branch, which means that we apply a set of 1D filters on each of these layers (filter sizes of 128, 256,and 128 respectively) that capture how the input signals evolve over the course of an action. A basic convolution block consists of a convolution layer, followed by batch normalization (for improving the speed, performance, and stability of the network), followed by an activation function, which is here a Rectified Linear Unit (ReLU). If you want more information about convolution layer and CNN models, take a look at my article aboutCNN achitecture.

Finally, global average pooling is applied after the final convolution block. It is used to reduce the number of parameters in the model prior to classification.

The output of the global pooling layer and the LSTM block is concatenated and passed onto a softmax classification layer.

Data set

LSTM-FCN for cardiology

ECG recordings from patients at a high risk of sudden death and healthy control subjects

Our data set is divided into 2 parts: one part for model training and another part for testing. The training will be on 23 sequences, and the test on 1189, these sequences are electrocardiograms (ECGs). An ECG is a test that checks how your heart is functioning by measuring the electrical activity of the heart. We have 2 different categories of ECG: one corresponding to patients at a high risk of sudden death, and another for healthy subjects.

This data set is named TwoLeadECG and is part of the UCR data sets, you can download it from here .

Baseline

The algorithm that serves as a reference for judging the results of the LSTM-FCN model is k-Nearest Neighbors (k-NN). The choice of this algorithm comes from the fact that it is an algorithm that is both simple and effective for the classification of time series.

The general idea behind k-NN applied to temporal data is quite simple, we will look at the k nearest neighbors (What a surprise !) of each sequence and see which class constitutes the majority of these sequences, in order to deduce the class of the new sequence. To know the nearest neighbors, we use the dynamic time warping algorithm that allows to measure the similarity (or distance) between two time series.

We test with various values of k (number of nearest neighbors) ranging from 1 to 10, we find ourselves with an accuracy on the test data set which varies between 0.70 and 0.93, this last value being reached for k = 1

LSTM-FCN for cardiology

LSTM-FCN Model

Code

LSTM-FCN function

Results

LSTM-FCN for cardiology

LSTM-FCN for cardiology

As we can see on the model loss graph, the loss function curves (training and validation) are gradually decreasing and converging towards the same point, indicating that learning has gone well and that there has been neither over-fitting nor under-fitting.

Regarding model accuracy graph, it confirms the good learning of the model and especially shows that the model gives very good results. Thus, when we apply the model on the test data set we have a accuracy of 100%, our model manages to perfectly classify the different electrocardiograms.

A performance that goes beyond the results we have seen with k-NN, and can even be considered better than cardiologists’ since we get 100% accuracy !


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

游戏编程入门

游戏编程入门

莫里森 / 人民邮电出版社 / 2005-9 / 49.00元

本书介绍如何设计和构建自己的计算机游戏。书中从零开始,引导读者开发一个“即插即用”的游戏引擎,并基于该引擎,循序渐进地开发7个完整的游戏。全书分为8个部分,共24章,内容包括游戏编程基础知识、如何与玩家交互、使用子画面动画、使用声音和音乐、高级动画、游戏人工智能、增添游戏的趣味性和附加练习。此外,在随书光盘中提供有附录,包括C++语言和windows编程的入门指导、游戏开发工具以及游戏图形创建的介......一起来看看 《游戏编程入门》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换