Abstract
BACKGROUND: Women were disproportionately affected by sexually transmitted infections (STIs), both physically and psychologically. The underlying reasons are likely multifaceted, ranging from individual behavior to relationship power, gender norms, and economic inequities. This study aims to identify predictors of STIs risk in women and men and to explore gender differences in the behavioral patterns that may contribute to STIs risk. METHODS: We analyzed the data from the third United Kingdom National Survey of Sexual Attitudes and Lifestyles, including 15,162 participants aged 16–74 from 2010 to 2012. According to the five levels of individual, interpersonal, community, institutional, and structural in the socio-ecological model (SEM), we selected 119 features from the dataset. Then we applied three deep learning algorithms and two traditional machine learning algorithms to address the influential factors of STIs. To evaluate the performance, we computed the metrics such as the area under the receiver operating characteristic curve (AUC), accuracy, precision, and recall. The results interpretation of the best model is based on feature importance analysis within the context of SEM. RESULTS: The tabular transformer model, FT-transformer, demonstrated excellent performance in predicting STIs risk in British males (AUC = 0.843, Accuracy = 87.0%) and females (AUC = 0.879, Accuracy = 87.5%) among five models. The top 10 influential factors to predict STIs risk for British males and females are different. The most influential factor for males is perceived social norms, and for females is guaranteed confidentiality. CONCLUSION: The high accuracy of the transformer model in predicting STIs risk highlights the need to use multi-level factors to identify gender-specific risk factors, which could be used in the future to formulate gender-tailored interventions in STIs prevention, diagnosis, and treatment. SUPPLEMENTARY INFORMATION: The online version contains supplementary material available at 10.1186/s12889-026-26602-2.