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
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
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
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 Model
Code
Results
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 !
The code is available here:
References
IEEE Xplore Full-Text PDF:
Edit description
ieeexplore.ieee.org
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
数据结构与算法分析
(美)(C.A.谢弗)Clifford A.Shaffer / 电子工业出版社 / 1998-8 / 35.00元
本书综合“数据结构与算法”的知识梳理、习题解答及上机辅导等于一身;精心挑选了覆盖教学大纲的五百多道题目,并且提供所有题目的参考答案;对于较难的算法和上机题,给出了详细的分析和说明;对于学习的重点和难点、易犯的错误、题目的难易和重要性,以及国内教材的差异等都给出了必要的说明。 本书可给使用各种教材讲授和学习“数据结构与算法”(或者“数据结构”)的师生参考,是系统复习该课程和准备应考计算......一起来看看 《数据结构与算法分析》 这本书的介绍吧!