Skychain: AI for Heart Diseases Recognition in development
Skychain has started developing the neural network for heart diseases recognition, which detects deviations by analyzing digitized ECGs.
Heart disease is the leading cause of death in the United States. More than 600,000 Americans die of heart disease each year. That is one in every four deaths in this country.
Every year about 735,000 Americans have a heart attack. Of these, 525,000 are a first heart attack and 210,000 happen in people who have already had a heart attack.
Skychain is developing the AI to recognize heart diseases using digitized ECGs. Maria Zorkaltseva, the Skychain data science developer, took data for training from PTB ECG database available at the Physiobank which contains 549 records from 290 subjects with ECG sampling frequency of 1000 Hz.
The database includes records of the following diseases:
- Myocardial infarction,
- Cardiomyopathy/Heart failure,
- Bundle branch block,
- Myocardial hypertrophy,
- Valvular heart disease,
- Healthy controls.
We take only the first ECG record for each patient. For each record, there is a header file with information of such additional features as age, smoker/non-smoker and the accompanying diagnosis.
Models were trained in two modes:
- using only ECG signals;
- using ECG signals and additional features extracted from header files.
To artificially increase the sample length of examples for training and testing, the method of dividing signals into windows was used. ECG signal preprocessing can thus be conducted in two ways:
- dividing signals into fixed-size windows (in the case of recurrent neural networks);
- dividing signals into cardiac cycles with 2 heart beat each (in case of convolutional neural networks).
The data was divided into train and test sets by patient id in the ratio of 80% to 20%, respectively.
Neural network models
In this work, various architectures and types of neural networks (convolutional, recurrent) with different dimensions of the input tensors were tested:
a) one-dimensional convolutional neural network with an input tensor (window_size, channel);
b) a two-dimensional convolutional neural network with an input tensor (cardiac_cycles, window_size, channel);
c) recurrent neural network (LSTM) with an input tensor (window_size, channel).
Categorical crossentropy and categorical accuracy were used as the loss function and a metric, respectively. For monitoring, the loss function was chosen and the model with the optimal loss function value were saved after each epoch, thus, in the end, the model with “the best” weights was used for prediction. If the loss function value did not change after 5 epochs, the learning_rate decreased twice to the minimal value of 0.00001. The initial learning rate was 0.001. For optimization, an adaptive back-propagation method Adam was used.
The training process stopped if the loss function value remained the same during 10 epochs. This method is called EarlyStopping. Thinning with a probability of 0.5 was used as a regularization.
With the help of the proposed neural networks, two classes (Myocardial infarction, Healthy control), taken from the PTB ECG database, are determined with sufficiently high accuracy.
In the task of detecting heart diseases on digitized ECG, convolutional neural networks show higher accuracy than recurrent ones. In turn, two-dimensional convolutional networks cope with the task better than one-dimensional. The introduction of additional features allows to obtain higher accuracy than when learning only with ECG signals. The best results are shown by a two-dimensional convolutional network with additional features.
These are the results of two-dimensional convolutional networks with additional features (case 2bd) and without (case 1bd) below.
Average categorical_accuracy for 5 folds (train data): 87.53% (+/- 7.56%)
Accuracy score on test data: 0.83
Matthews coeff on test data: 0.61
Average categorical_accuracy for 5 folds (train data): 99.39% (+/- 1.21%)
Accuracy score on test data: 1.0
Matthews coeff on test data: 1.0
For better understanding of precision and recall metrics, read the article here: https://en.wikipedia.org/wiki/Precision_and_recall
Further work includes adding additional classes of heart diseases to the models that can be classified with high accuracy by expanding datasets. It is also planned to add residual blocks to convolutional neural networks and compare the results with existing ones.
Try Skychain Alpha.