Numerous studies are aimed at diagnosing heart diseases based on 12-lead
electrocardiographic (ECG) records using deep learning methods. These studies
usually use specific datasets that differ in size and parameters, such as
patient metadata, number of doctors annotating ECGs, types of devices for ECG
recording, data preprocessing techniques, etc. It is well-known that
high-quality deep neural networks trained on one ECG dataset do not necessarily
perform well on another dataset or clinical settings. In this paper, we propose
a methodology to improve the quality of heart disease prediction regardless of
the dataset by training neural networks on a variety of datasets with further
fine-tuning for the specific dataset. To show its applicability, we train
different neural networks on a large private dataset TIS containing various ECG
records from multiple hospitals and on a relatively small public dataset
PTB-XL. We demonstrate that training the networks on a large dataset and
fine-tuning it on a small dataset from another source outperforms the networks
trained only on one small dataset. We also show how the ability of a deep
neural networks to generalize allows to improve classification quality of more
diseases