Moch Deny Pratama, Faris Abdi El Hakim, Dimas Novian Aditia Syahputra, Dodik Arwin Dermawan, Asmunin, Salamun Rohman Nudin, Andi Iwan Nurhidayat
Cardiovascular Diseases (CVDs) remain the leading cause of death worldwide, with significant socioeconomic consequences due to premature death and chronic disability. Although clinical screening techniques have evolved, early and accurate prediction of heart disease is still partial due to the limited capacity of conventional machine learning algorithms to model the complex nonlinear interactions among various contributing risk factors e.g., hypertension, diabetes, hyperlipidemia, and genetic predisposition. To address these challenges, this research introduces a hybrid framework that combines the Transformer architecture known for its robust self-attention mechanism and high representational capabilities with Ant Colony Optimization (ACO), a nature-inspired metaheuristic algorithm modeled on the foraging behavior of ants, to enable adaptive and efficient hyperparameter optimization. This dataset is relatively balanced, with 55.34% of patients diagnosed with heart disease and 44.66% without heart disease. To ensure reliable evaluation and minimize the risk of overfitting, we implemented a nested cross-validation protocol, maintaining a consistent class distribution across folds. The proposed model processes structured data by encoding categorical variables into embeddings and normalizing features, resulting in a unified tabular representation suitable for transformer-based analysis. ACO improves model efficiency by optimizing key parameters e.g., embedding configuration, learning rate, and depth, reducing manual intervention and computational overhead. The proposed Hybrid Transformer-ACO model focuses on interpretable clinical features to provide actionable risk stratification. Model evaluation was performed using classification metrics e.g., accuracy, precision, recall, F1 score, and time complexity to measure predictive performance and computational efficiency during the training and inference phases. These evaluation criteria provide evidence of the model's diagnostic reliability, and potential feasibility for application. The model achieved average accuracy of 99.67% (±0.12), sensitivity of 99.59% (±0.18), specificity of 99.76% (±0.10), and an F1 score of 99.63% (±0.14). Time complexity analysis demonstrated efficient training and testing, while the model interpretability supports transparency and trust. © Authors retain all copyrights.
Department of Informatics Management, Universitas Negeri Surabaya, Surabaya, Indonesia