In developing countries, affording stateof-the-art technology such as using polymerase chain reaction (PCR) devices to detect tuberculosis (TB) cases, e.g. Gen-eXpert®MTB/Rif, is still hard.
Yet, these countries are the ones where the number of TB cases is still high.
According to the Global Tuberculosis Report 2016 (World Health Organization, 2016) , "Six countries accounted for 60% of the new cases: India, Indonesia, China, Nigeria, Pakistan and South Africa."
Recent cases of COVID-19 have shown that population-wide testing and contact tracing are necessary for deadly communicable diseases (Panovska-Griffiths et al., 2020; Matukas et al., 2020) . Mass verbal screening can help to overcome this challenge in early detection of tuberculosis (Bothamley et al., 2002; Malik et al., 2018) . However, this solution tends to have low specificity. This work addresses the problem by developing a machine learning model to increase the verbal screening performance.
Most medical diagnosis cases have to deal with the imbalanced dataset problem (Jothi et al., 2015) . Since the majority of the people are healthy, the classification results are more likely to be negative. Since we want to prevent an epidemic because TB is a communicable disease, our goal is then to keep the sensitivity as high as possible while trying to increase the specificity.
We utilised several machine learning algorithms, namely support vector machines (SVM) with Gaussian (RBF) kernel (Fernández-Delgado et al., 2014) and XG-Boost (Chen and Guestrin, 2016) . As a benchmark, we also employed a logistic regression model. We evaluated our models by comparing our predictions with the corresponding GeneXpert®MTB/Rif results. We used two score-based classification methods as the baselines in this study.
Automated tuberculosis (TB) detection has been studied for nearly two decades. One way to detect TB cases automatically is by using a rule-based approach from both clinical and laboratory criteria (Hripcsak et al., 1997) .
In a more recent approach, Shamshirband et al. (2014) were able to achieve 87.00% sensitivity and 86.12% specificity in TB diagnosis using Artificial Immune Recognition System (AIRS) learned from supporting lab results. It is also shown in (Seixas et al., 2013) that using artificial neural networks (ANN) could help them to reach more 94.5% sensitivity and 91.0% specificity in diagnosing pleural TB based on anamnesis variables and HIV status.
Although a real-time screening alert has been done in (Weng et al., 2011) , machine learning was not employed in that study. Therefore, we proposed to do so in this paper aiming for a simpler but more effective tool to identify TB suspects compared to simple score or rule-based methods.
Cohort The dataset in this study was collected by field workers. The data were collected from 12 November 2013 to 1 July 2016 from several sites in Jakarta, Indonesia. The dataset we are using in this experiment consists of 8732 rows where each row corresponds to an individual with 7508 TB-and 1224 TB+ from the screening process with their available GeneXpert®MTB/Rif result. We are also focusing on people with no history of TB before our study. Due to inaccuracy, we chose to remove the rows where the height is either unavailable or less than 120 cm.
We divided our dataset into three sets, i.e. training, validation, and test sets (60:20:20). We built our models using machine learning algorithms from the training set and then evaluated them with the validation set. Eventually, we tested the best models from each algorithm on the test set.
Features The features in this study are symptoms, comorbidities, and characteristics commonly found in TB patients. Four attributes in this dataset are of numerical values, i.e. height, weight, age, and cough duration (in days). We also used the sex of the people screened as the attributes for machine learning algorithms. The statistical properties of the features can be seen in Table 1 .
Aside from derived attributes like the body mass index (BMI), the attributes were acquired by verbally asking the subjects. We only marked 'Yes' as the value of diabetes, kidney failure, asthma, COPD, and HIV questions if the subjects had done the appropriate lab test before. We can see that breathing shortness, chest pain, diabetes, family diabetes, TB exposure, kidney fail-ure, asthma, COPD, and HIV contain lots of unknown values. This is because they were added later in the field study. Comorbidity in particular needs to be confirmed by a lab test for our screeners to report them as a yes/no. 
Classification Algorithms Our clinicians devised two scoring methods that were used throughout the project. When the total score of a person exceeds a certain threshold, we classify that person as a TB suspect. Those TB suspects were then tested by GeneXpert®MTB/Rif to confirm our finding. The pseudo-code for these methods can be seen in Algorithm 1 and Algorithm 2 in the Appendix. In these two algorithms, a person will be categorised as underweight if their BMI is lower than 18.5. This method needs experts to define the scoring scheme, i.e. how each attribute contributes to our suspicion about whether a person is TB+. To deal with this problem, we proposed a machine learning classification which continues to learn as the number of data grows larger. We employed support vector machine (SVM) (Boser et al., 1992) , XG-Boost (Chen and Guestrin, 2016) , and logistic regression models to classify the individuals.
We trained the untuned version of each machine learning algorithm first to get an idea of how a cost-sensitive approach would later improve our models. We kept the parameters to the default settings and imputed the unknown/null values to the most frequent values. After that, we trained the models using a different weighting of positive class with the chosen hyperparameters. We tuned the hyperparameters with several different class weights, such as 10, 15, 20, 25, 30, 35, 40, 45, and 50 . We did a grid search with 3fold cross-validation using our training data to get the optimal AUC score. We chose AUC score to optimise both sensitivity and specificity.
Untuned Classifiers The untuned classifiers tend to favour the negative class as can be seen in Table 2 . The machine learning classifiers performed worse than the scorebased classifiers because the training set is highly imbalanced while the score-based classifiers are optimised for sensitivity.
In SVM case, we got higher sensitivity than Score-2 and higher specificity than Score-1 when we used at least 15 as the positive class weight. While the class weight is less than 20, we can also produce at least the same specificity as Score-1 with SVM. With XGBoost, we got an even better result: increasing the specificity from 20.63% to 35.78% while only reducing the sensitivity from 93.16% to 92.74% The Effect of Dataset Size As shown in Figure 1 , all the metrics seem to converge when the number of training data is ≈ 2000. Our exploration with the subsampling method also turned out to be ineffective as shown in Table 2 . These results imply that using cost-sensitive classifiers is preferred to using subsampling to overcome the imbalanced class problem.
Evaluation on Test Set Although the best specificity is achieved by the Score-2 method, the sensitivity is low despite being used for early stage TB diagnostics. Our best compromise is to use the XGBoost model where the sensitivity and specificity are the second-best overall.
We were able to increase the specificity while still keeping the sensitivity relatively high by using machine learning algorithms. We showed that using imbalanced weighting for the classes is necessary for this task. Furthermore, the best model converged after around 2000 data points. Therefore, we might use this as a reference point in further experiments. Increasing the specificity by more than 10% as achieved in this study means saving lots of money and time to do unnecessary tests. We can achieve this without losing any sick people in the screening process. In a more practical sense, the best model from our work can be installed on smartphones where verbal screeners can rapidly identify TB suspects, especially in rural and poor areas where access to clinics might be limited. The suspects can then be taken to better health facilities to be tested further to confirm the findings.
World Health Organization. Global tuberculosis report 2016. 2016.