  Learning information-rich and generalizable representations effectively from
unlabeled multivariate cardiac signals to identify abnormal heart rhythms
(cardiac arrhythmias) is valuable in real-world clinical settings but often
challenging due to its complex temporal dynamics. Cardiac arrhythmias can vary
significantly in temporal patterns even for the same patient ($i.e.$, intra
subject difference). Meanwhile, the same type of cardiac arrhythmia can show
different temporal patterns among different patients due to different cardiac
structures ($i.e.$, inter subject difference). In this paper, we address the
challenges by proposing an Intra-inter Subject self-supervised Learning (ISL)
model that is customized for multivariate cardiac signals. Our proposed ISL
model integrates medical knowledge into self-supervision to effectively learn
from intra-inter subject differences. In intra subject self-supervision, ISL
model first extracts heartbeat-level features from each subject using a
channel-wise attentional CNN-RNN encoder. Then a stationarity test module is
employed to capture the temporal dependencies between heartbeats. In inter
subject self-supervision, we design a set of data augmentations according to
the clinical characteristics of cardiac signals and perform contrastive
learning among subjects to learn distinctive representations for various types
of patients. Extensive experiments on three real-world datasets were conducted.
In a semi-supervised transfer learning scenario, our pre-trained ISL model
leads about 10% improvement over supervised training when only 1% labeled data
is available, suggesting strong generalizability and robustness of the model.
