Abstract
Cross-dataset modeling of electrocardiogram signals faces the dual challenges of domain shift and insufficient interpretability in clinical applications. To address these issues, this study proposes a Transformer-based cross-domain ECG modeling framework that incorporates a Domain-invariant Feature Enhancement Module and an Interpretability-driven Attention Constraint Mechanism, aiming to simultaneously improve cross-domain generalization and clinical interpretability. Experiments on four authoritative arrhythmia databases (MIT-BIH Supraventricular, MIT-BIH Arrhythmia, INCART, and SCD-Holter) demonstrate that the proposed method achieves the best performance across all target domains, with accuracy on the MIT-BIH Arrhythmia dataset reaching 0.768 (an improvement of 8.4% over the baseline Transformer) and F1-score on the INCART dataset attaining 0.898 (a gain of 4.7% compared with the second-best method). In addition, ablation studies verify the complementary contributions of DFEM and IACM, while feature importance analysis and t-SNE visualization further confirm that the model consistently attends to clinically relevant features. These results indicate that the proposed framework can effectively mitigate domain shift without relying on target-domain samples, while enhancing interpretability alongside discriminative performance.