Artificial intelligence has shown great potential in improving the accuracy and efficiency of diagnoses, as well as aiding in the identification of risk factors for various diseases. The present study evaluated the preoperative use of ML algorithms to predict PJI in patients undergoing r-THA and r-TKA using available preoperative clinical data. The most pertinent findings of the present study was that the algorithm adopted demonstrated good discriminatory performance for the prediction of PJI in the selected patients (area under the curve 0.770 ± 0.006 in training set and 0.720 ± 0.057 in test set). The measurement of systemic markers of inflammation such as serum C-reactive protein (CRP), serum RDW and serum related eosinophils were the most predictive feature, readily available preoperative, positively correlated with the outcome PJI. Gender is also informative in the form of reverse association, as women demonstrate a higher level of protection against PJI. The measurement of erythrocyte sedimentation rate (ESR) level, a validated systemic marker of inflammation, was not considered as a feature because the quote of missing values was above to 25%. ML models may be improved by incorporating clinical relevant variables regarding PJI as joint local phenomenon, and not as a systemic process, such as synovial white blood cell (WBC) and synovial polymorphonuclear neutrophils (PMN) which could be obtained through a preoperative joint aspiration. Currently, surgeons and internal medicine physicians seeking to diagnose PJI used a multidisciplinary test battery that included tests to detect joint local inflammation, such as synovial fluid white blood cell (WBC) count and synovial tissue histology [
14]. The analysis of synovial fluid obtained by preoperative aspiration, including total cell count and differential leucocyte count and cultures for aerobic and anaerobic organisms, has shown sufficient sensitivity and specificity in multiple studies, it is the most valuable diagnostic tool and should be performed prior to the surgical revision [
4]. In our hospital no preoperative synovial fluid analysis was performed, therefore these interesting features were not reported. Regarding features related to formation of cutaneous fistulae and/or drainage of purulent secretions, the present study investigated features related to misdiagnosed “silent” PJI, hence, fistulae and purulent drainage were not considered. Moreover, a previous study reported that the rate of developing a sinus tract in PJI was 21.3%, the presence of sinus tract may be a proxy for other issues such as poor periarticular soft tissue, the poor nutritional status of the host, and multiple prior operations [
15]. PJI complication is estimated to occur in 1–3% of patients undergoing primary replacement and in 3–5% of patients undergoing revision [
16]. 219 patients were in the infected cohort and 1141 patients were in the aseptic cohort, the patients sample was representative and aligned to the existing literature [
1]. With wider application of the joint replacement surgery and related technologies, more and more patients receive the procedure. The incidences of PJI have been on the rise over the recent years and accurate diagnosis of the complication is an urgent task of clinical research. There is currently no universal guideline on the PJI prediction after THA or TKA. In clinical practice, patients at high risk of developing PJI after THA or TKA are identified based on the presence or absence of risk factors and clinicians can only predict the risk of PJI based on their experiences. Whenever a patient’s condition is complex or the dataset is incomplete, the difficulty of prediction may increase, requiring more time for an accurate prediction. The machine learning algorithm presented in this study may be a promising alternative to the manual risk prediction method in predicting preoperatively PJI in patients undergoing r-THA or r-TKA. The tool presented here can forecast patients with PJI before the surgery, the strongest predictors of the occurrence of PJI were high levels of serum CRP, serum RDW and serum Related Eosinophils. In recent years, medical researchers are increasingly employing ML applications in the prevention of PJI, the models were divided into four categories: prediction, diagnosis, antibiotic application and prognosis. Yeo et al in 2022 investigated the use of Artificial Neural Networks for the prediction of superficial surgical site infections and PJI following TKA. They retrospectively included a total of 10,021 consecutive primary TKA patients; the average follow-up time lasted for about 2.8 years. SSIs were reported in 404 (4.0%) TKA patients, including 223 superficial surgical site infections and 181 PJI. The patients’ demographic and operational variables were collected. The model performance was good, with an AUC of 0.84 and a Brier score of 0.054 (a Brier score close to zero indicates good accuracy of probabilistic prediction). The strongest predictors of the occurrence of surgical site infections following primary TKA, were Charlson comorbidity index, obesity (BMI >30kg/m2), and smoking. The neural network model of the study represented an accurate method to predict patient-specific superficial surgical site infections and PJI following primary TKA [
17]. Klemt et al in 2021 used artificial intelligence to evaluate prognostic outcomes. They retrospectively reviewed 618 r-TKA procedures for PJI. They showed a ML model with excellent performance for the prediction of recurrent infections in patients following r-TKA for PJI. The ML models all achieved excellent performance across discrimination (AUC range 0.81–0.84), a Brier score of 0.053 (close to zero indicating good accuracy of the probabilistic prediction). The strongest predictors for recurrent PJI were previous surgeries in patients following r-TKA included irrigation and debridement with or without modular component exchange (p < 0.001), > 4 prior open surgeries (p < 0.001), metastatic disease (p < 0.001), drug abuse (p < 0.001), HIV/AIDS (p < 0.01), presence of Enterococcus species (p < 0.01) and obesity (p < 0.01) [
18]. Tao et al in 2022 trained a deep learning model to diagnose PJI. 20 r-TKA were enrolled from Chinese People’s Liberation Army General Hospital. PJI infection was based on the 2018 ICM guidelines. Frozen pathological sections collected were converted into electronic images with 461 positive and 461 negative images for model training. The AUC of the model was 0.814 and an average accuracy of 93.3 % [
19]. Wu et al developed an accurate machine learning model using administrative and electronic medical records (EMR) to improve the accuracy of surgical site infections (SSI) detection. The study cohort consisted of 16,561 primary TKA and 10,799 primary THA retrospectively included. Their findings suggested ML models derived from administrative data and EMR text data achieved high performance and can be used to automate the detection of complex SSIs: ROC AUC of 0.906 (95% CI 0.835–0.978), PR AUC of 0.637 (95% CI 0.528–0.746) and F1 score of 0.790 (0.670–0.900) [
20]. The study findings need to be interpreted in light of its limitations. First, this study design was a retrospective study, which is associated with inherent limitations and reporting bias. Second, it’s a single-institution study, which introduced the potential for confounding effects of unmeasured variables and features; our results may not be generalizable to other institutions. Third, the minimum patients follow-up period was 2 years, but that a larger percentage of recurrent infections and re-revisions may occur with longer follow-up time. Lastly, the sample size is relatively small and the label imbalance is quite pronounced. To obtain more consistent results, new studies with larger cohorts are necessary. Future prospective multicenter studies with long-term follow-up should include more features to construct more widely functioning models to improve their accuracy and performance in the prediction of PJI.