{'fraction_non_alphanumeric': 0.04072897970454232, 'fraction_numerical': 0.020502554190252657, 'mean_word_length': 4.730617088607595, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Diagnosis of COVID-19 Cases from Chest X-ray Images Using Deep Neural Network and LightGBM

The Coronavirus was detected in Wuhan, China in late 2019 and then led to a pandemic with a rapid worldwide outbreak. The number of infected people has been swiftly increasing since then. Therefore, in this study, an attempt was made to propose a new and efficient method for automatic diagnosis of Corona disease from X-ray images using Deep Neural Networks (DNNs). In the proposed method, the DensNet169 was used to extract the features of the patients' Chest X-Ray (CXR) images. The extracted features were given to a feature selection algorithm (i.e., ANOVA) to select a number of them. Finally, the selected features were classified by LightGBM algorithm. The proposed approach was evaluated on the ChestX-ray8 dataset and reached 99.20% and 94.22% accuracies in the two-class (i.e., COVID-19 and No-findings) and multi-class (i.e., COVID-19, Pneumonia, and No-findings) classification problems, respectively.


I. INTRODUCTION
In late December 2019 and at the beginning of the 2020, a new type of acute respiratory disease was identified in Wuhan, Hubei Province, China for the first time [1]. The disease spread rapidly, while the number of people infected with it is still increasing swiftly and causing death of a large number of them [2]. The disease was caused by Severe Acute Respiratory Syndrome Coronavirus 2 (SARS-CoV-2) and called COVID-19 virus by the World Health Organization [3]. The symptoms of this disease, which might be mild or severe, included fever, dry cough, sore throat, headache, fatigue, and shortness of breath [4], [5]. The best ways to prevent the spread of this virus have been to observe a proper physical distance at all times, avoid touching the eyes, nose, and mouth with unwashed hands, and use a mask to completely cover the nose and mouth [6].
Generally, there are several tests for the diagnosis of Coronavirus disease, including the Real-Time Reverse Transcription-Polymerase Chain Reaction (RT-PCR) test. This test depends on specialized equipment and is time-consuming. It does not have high accuracy and the results may include false-negative [7], [8]. Other tests have incorporated radiographic imaging of the chest, such as Computed Tomography-Scan (CT-Scan) and Chest X-Ray (CXR) [7], [9] .
The equipment required for these types of tests are lightweight and portable, while their imaging takes about 15 seconds for each patient [10]. Radiographic imaging devices are available in most specialized laboratory centers, clinics, and hospitals. Analysis and pre-examination of CXR images taken from the patients with COVID-19 showed that this type of test was a fast approach and one of the most cost-effective methods for diagnosing the mentioned patients. Therefore, this type of image was applied in this study [11].
Deep Learning (DL) is a subset of a broader family of machine learning algorithms based on artificial neural networks. A Convolutional Neural Network (CNN) is a type of neural network architecture, which is utilized as an efficient and intelligent architecture in pattern recognition and image classification, especially in the field of medical and radiological images and disease diagnosis [12]- [14] .
CNNs are multilayered neural networks, through which images can be properly recognized by using convolution and pooling layers to reduce their main features [15]. There are varied approaches to employing a Deep CNN (DCNN) depending on the type of problem. In this regard, one of the existing methods is to use pre-trained models. A pre-trained model is a model created and trained on a large dataset to solve a problem. These models are available as open-source.
In this research, image features were extracted by using pretrained networks in the first step. Then, those features were given to the ANOVA algorithm to reduce features and select a number of them to improve the performance. Then the selected features were provided as input to the LightGBM to classify the images. The remainder of the paper is structured as follows: In section II, related researches will be reviewed. Section III provides the required background topics like the LightGBM method. In section IV, the proposed approach will be introduced. The results will be reported and discussed in section V. Finally, in section VI, a summary of the findings and conclusion will be presented.

II. RELATED WORKS
Wang et al. [16] developed a deep convolutional neural network called COVID-Net by using CXR images, which helped physicians in the screening phase. In their research, Narin et al. [17] presented the five previously trained CNN models of ResNet50, ResNet101, ResNet152, InceptionV3, and Inception-ResNetV2 to diagnose patients with pneumonia and COVID-19 using their patients' CXR images. Abbas et al. [18]  Minaee et al. [21] applied a dataset of 5,000 CXR images of patients with the 4 CNNs of ResNet50, ResNet18, SqueezeNet, and DenseNet-121 to diagnose COVID-19 disease. In their investigation, Iqbal Khan et al. [22] proposed a CoroNet model, which was based on a pre-trained Xception architecture, by using a DCNN for automatic diagnosis of COVID-19 disease. In the proposed CoroNet model, they achieved 95% accuracy for the multi-class problem (i.e., COVID-19, Pneumonia, and No-findings). Ozturk et al. [11] proposed a Deep Neural Network (DNN) based on the DarkNet model. In their study, they utilized 1,125 CT-scan images, including 125, 500, and 500 images of patients' chests with Corona disease, pneumonia, and no-findings, respectively. In their two-class and multi-class classification problems, they reached accuracies of 98.08% and 87.02%, respectively. Nasiri and Hasani [23] employed a DNN, i.e., DenseNet169, and the XGBoost algorithm to extract image features and classify them, respectively. They attained average accuracies of 98.24% and 89.70% in two-class and multi-class problems, respectively.

III. BACKGROUNDS
This section introduces the DenseNet169, LightGBM algorithm, and Analysis of Variance (ANOVA) employed in the proposed method.

A. DenseNet169
DenseNet169 is one of the DenseNet models designed for image classification. All the DenseNet models are pre-trained on the ImageNet dataset. Each layer in the DenseNet receives inputs from the previous layers and sends its output to the next layers. Since each layer receives features from all the previous layers, the network can become more compact, resulting in fewer channels, which improves computational performance. Its main difference with the DenseNet121 model is in its size and accuracy. The DenseNet169 is about 55 MB larger than the DenseNet121 (315 MB). This network has been able to achieve 93.20% accuracy in the ImageNet dataset [24].

B. LightGBM
The Light Gradient Boosting Machine (LightGBM) algorithm is an open-source, distributed, high-performance Gradient-Boosting (GB) framework, which has been originally introduced by Microsoft [25], [26]. Ke et al. [25] proposed a decision tree for efficient GB using a Gradient-based One-way Sampling Solution (GOSS) and an Exclusive Feature Bundling (EFB) called LightGBM [27]. Unlike other boosting algorithms that grow a tree level by level, LightGBM grows it with the help of GOSS and a leaf-wise tree growth approach. The two GOSS and EFB techniques discussed below form the basis of the LightGBM algorithm [25], [27].

Gradient-based One-way Sampling Solution (GOSS):
Samples with different gradients play different roles in calculating information gain. According to the information gain definition, samples with larger gradients have a greater role in the information gain. As a result, GOSS retains samples with larger gradients and randomly drops those with smaller ones. This provides higher estimation accuracy compared to a uniform random sampling with the same sampling rate. Mathematically speaking, consider a training dataset with n samples 12 { 1 a b is utilized to normalize the gradients [25], [27].
Exclusive Feature Bundling (EFB): Data in a highdimensional space is usually very sparse and analyzing it has many challenges [29]. The sparsity of the feature space makes it possible to reduce the number of features by designing a lossless method. In the EFB method, several features are bundled into a single one. Thus, the computational complexity of LightGBM changes from bundle and since ## bundle features , the training speed increases without decreasing accuracy [25], [27], [28].
In general, the LightGBM algorithm is an improved and much more efficient version of the Gradient-Boosted Decision Tree (GBDT) method, like XGBoost [27], [30]- [32]. This algorithm has been proven to speed up the conventional GBDT training process by more than 20 times while achieving almost the same accuracy. The output predicted by the LightGBM model is given in the following formula: Fh xx (2) where M and () m h x denote the maximum number of iterations, and the base decision tree, respectively.

C. ANOVA Feature Selection Method
Feature selection is the process of identifying the relevant features and removing the irrelevant and redundant ones to reduce the number of input variables when developing a model. By decreasing the input variables, the model's computational cost is reduced and its accuracy is enhanced in some cases. The ANOVA method is a popular statistical approach for comparing several independent means. In this method, the features are scored based on the ratio of the between-group variance to the within-group variance through the F-test [33]. The statistical ratio of the F-test is given in (3).

IV. PROPOSED METHOD
In this research, the pre-trained DenseNet169 model was first used to extract image features. Then, the last layer of the DenseNet169, which was configured to predict ImageNet dataset classes, was removed. To reduce the number of extraction features that could lower the computational complexity and avoid the risk of overfitting, an average pooling layer was added to the end of the network. Then, the extracted features were given to the ANOVA features selection algorithm to reduce features and select a number of them to improve the performance. Finally, the selected features were provided as input to the LightGBM algorithm to classify the images and detect COVID-19 cases. The LightGBM was trained by using the feature vector of the input images and their corresponding labels. The proposed method's framework is depicted in Fig. 2.

V. EXPERIMENTAL RESULTS
The ChestX-ray8 dataset [34] was employed to evaluate the proposed algorithm. This dataset included a total of 1125 images, consisting of 125, 500, and 500 images of patients' chests with Corona disease, pneumonia, and no-findings, respectively. Fig. 1 shows the sample images in the dataset. For evaluating the proposed method, the experiments were carried out in two ways, while in both experiments, 60%, 20%, and 20% of the data were utilized for train, validation, and test, respectively. In the first experiment, the multi-class problem (i.e., COVID-19, Pneumonia, and No-findings), 1125 images, and in the second experiment, the two-class problem (i.e., COVID-19, No-findings), 625 images were taken into account.

Fig. 1. Sample Images in the Dataset
The best trained DNN was chosen among eight networks in the first stage. Table I shows the results of this experiment. As the results show, the DenseNet169 network has the highest accuracy and has been selected as the desired network to be applied in the proposed method. The output of this network is a feature vector with 1664 features. In the second step, the ANOVA algorithm was utilized to select the features. According to the results obtained from the validation set, 116 and 133 features were selected in the multi-class and two-class classification problems, respectively. Finally, in the last step, the parameters of the LightGBM algorithm were tuned by trial and error. The mentioned parameters are presented in Table II.  Fig. 2. Framework of the proposed method After tuning the parameters, the accuracy of the proposed method was obtained by using the test set. The accuracy for multi-class problem was 94.22% and the average accuracy for two-class problem was 99.20%. It should be noted that in the two-class problem, the 5-fold cross-validation method was employed. The confusion matrix for the multi-class problem can be seen in Fig. 3. Also, the confusion matrix for each fold of the two-class problem and all the data set is depicted in Fig.  4.

TP Precision
TP FP (6) Accuracy: Mathematically, it is the result of dividing the sum of true negative and true positive cases by the sum of true negative, true positive, false negative, and false positive cases (total number of cases) as shown in (7).

TN TP Accuracy
TN TP FN FP (7) F1-Score: Mathematically speaking, it is the result of dividing the doubled precision and sensitivity by their sum as shown in (8) [33]. 1

-
() Precision Sensitivity F Score Precision Sensitivity (8) Tables III and Table IV represent the comparison of the proposed method with other methods in two-class and multiclass problems, respectively. As can be seen from the results of these tables, the proposed method has performed better than the other methods in both problems. Table V compares the proposed method with other DL methods, in which chest images have been employed. As can be observed, the proposed method in this research has better accuracy than other proposed methods. Of course, the results shown in Table V have not been tested on the same dataset.

VI. CONCLUSION
In this paper, using artificial intelligence techniques, a model was proposed for diagnosing people with COVID-19. The DenseNet169 was employed in the proposed approach to extract image features. The number of the extracted features was reduced by using the ANOVA feature selection algorithm and finally, the LightGBM algorithm performed image classification to diagnose COVID-19. The results obtained from the evaluation experiments revealed that the proposed method had the accuracies of 94.22% and 99.20% in the multiclass and two-class problems, respectively, which still showed higher accuracies than those of the other methods. It should be noted that unlike the methods presented by other researchers, only the LightGBM algorithm was trained in the proposed method, while the DNN did not need any training, thus enhancing the speed of this method and reducing its complexity.