Pre-exposure prophylaxis (PrEP) is an effective HIV prevention tool that relies on good adherence in high-risk scenarios. To understand the factors that predict adherence, technology such as mobile applications like UPrEPU—allowing for logging users’ daily behaviours at close to the time they have sex or PrEP intake—can be used as a person-centred, self-care intervention. This study aims to develop a machine learning model using logs of sexual activities and user attributes recorded in the UPrEPU mobile application in Taiwan to predict whether a sexual event was protected by oral PrEP among gay, bisexual and other men who have sex with men (GBMSM).
We used data from the UPrEPU app collected between January 2022 and May 2023 in Taiwan. The dataset included information on users’ sex events, such as the timing and users’ sex roles (e.g. versatile, receptive or insertive partner), and the dynamic user-based attributes related to sexual behaviours and PrEP use. Various subsets of these features were employed in CatBoost models to predict whether the sex events were associated with correct PrEP use. We evaluated the models’ performance using five-fold cross-validation. The influential features were identified through feature importance analysis and Shapley Additive Explanations (SHAP) values to explain the models.
A total of 198 users recorded 2356 anal sex events on UPrEPU. The model with dynamic user-based attributes outperformed those without them. The most parsimonious model had a good prediction performance (accuracy = 75%, precision = 78%, recall = 90%, F1-score = 83%) and identified the key features of PrEP protection. The model with five dynamic user-based attributes—age, cumulative PrEP use, condom use and the proportion of anal sex events with HIV-negative partners not on PrEP—significantly outperformed the model based on event-level attributes alone.
Behavioural patterns significantly influence PrEP adherence among GBMSM. Person-centred mobile applications such as UPrEPU provide valuable data for tailored, just-in-time interventions, enhancing adherence. Recognizing these patterns can guide person-centred interventions. Incorporating these insights into clinical care or digital tools may improve consultations and support timely, informed HIV prevention decisions.