RESUMO
OBJECTIVE: Early diagnosis and differential diagnosis of tuberculous pleural effusion (TPE) remains challenging and is critical to the patients' prognosis. The present study aimed to develop nine machine learning (ML) algorithms for early diagnosis of TPE and compare their performance. METHODS: A total of 1435 untreated patients with pleural effusions (PEs) were retrospectively included and divided into the training set (80%) and the test set (20%). The demographic and laboratory variables were collected, preprocessed, and analyzed to select features, which were fed into nine ML algorithms to develop an optimal diagnostic model for TPE. The proposed model was validated by an independently external data. The decision curve analysis (DCA) and the SHapley Additive exPlanations (SHAP) were also applied. RESULTS: Support vector machine (SVM) was the best model in discriminating TPE from non-TPE, with a balanced accuracy of 87.7%, precision of 85.3%, area under the curve (AUC) of 0.914, sensitivity of 94.7%, specificity of 80.7%, and F1-score of 86.0% among the nine ML algorithms. The excellent diagnostic performance was also validated by the external data (a balanced accuracy of 87.7%, precision of 85.2%, and AUC of 0.898). Neural network (NN) and K-nearest neighbor (KNN) had better net benefits in clinical usefulness. Besides, PE adenosine deaminase (ADA), PE carcinoembryonic antigen (CEA), and serum CYFRA21-1 were identified as the top three important features for diagnosing TPE. CONCLUSIONS: This study developed and validated a SVM model for the early diagnosis of TPE, which might help clinicians provide better diagnosis and treatment for TPE patients.