# Pneumonia Detection in Chest X-Ray Images Using Enhanced Restricted Boltzmann Machine

Authors: Fazli Wahid; Sania Azhar; Sikandar Ali; Muhammad Sultan Zia; Faisal Abdulaziz Almisned; Abdu Gumaei
Journal: Journal of Healthcare Engineering
 (2022)

---

## Abstract

The process of pneumonia detection has been the focus of researchers as it has proved itself to be one of the most dangerous and life-threatening disorders. In recent years, many machine learning and deep learning algorithms have been applied in an attempt to automate this process but none of them has been successful significantly to achieve the highest possible accuracy. In a similar attempt, we propose an enhanced approach of a deep learning model called restricted Boltzmann machine (RBM) which is named enhanced RBM (ERBM). One of the major drawbacks associated with the standard format of RBM is its random weight initialization which leads to improper feature learning of the model during the training phase, resulting in poor performance of the machine. This problem has been tried to eliminate in this work by finding the differences between the means of a specific feature vector and the means of all features given as inputs to the machine. By performing this process, the reconstruction of the actual features is increased which ultimately reduces the error generated during the training phase of the model. The developed model has been applied to three different datasets of pneumonia diseases and the results have been compared with other state of the art techniques using different performance evaluation parameters. The proposed model gave highest accuracy of 98.56% followed by standard RBM, SVM, KNN, and decision tree which gave accuracies of 97.53%, 92.62%, 91.64%, and 88.77%, respectively, for dataset named dataset 2. Similarly, for the dataset 1, the highest accuracy of 96.66 has been observed for the eRBM followed by srRBM, KNN, decision tree, and SVM which gave accuracies of 90.22%, 89.34%, 87.65%, and 86.55%, respectively. In the same way, the accuracies observed for the dataset 3 by eRBM, standard RBM, KNN, decision tree, and SVM are 92.45%, 90.98%, 87.54%, 85.49%, and 84.54%, respectively. Similar observations can also be seen for other performance parameters showing the efficiency of the proposed model. As revealed in the results obtained, a significant improvement has been observed in the working of the RBM by introducing a new method of weight initialization during the training phase. The results show that the improved model outperforms other models in terms of different performance evaluation parameters, namely, accuracy, sensitivity, specificity,F1-score, and ROC curve.


---

## Body

## 1. Introduction

Pneumonia is a provocative surrounding of the lung fundamentally impacting the little air sacs known as alveoli. Results routinely join a blend of the valuable or dry hack, chest torture, fever, and inconvenience unwinding. Pneumonia is for the most part achieved by tainting with contaminations or organisms and less as a rule by various microorganisms. Recognizing reliable microorganisms can be problematic. The investigation is regularly established on signs and actual assessment. We can diagnose pneumonia through chest x-ray, blood tests, and culture of the sputum, and through it, the symptoms of pneumonia are observed [1]. The affliction may be requested by where it was picked up, for instance, crisis center got or clinical administrations-related pneumonia. Persons with compelling pneumonia routinely have a beneficial hack, fever, chills, breath problem, and infection in the chest [2].In the people, chaos may be the most obvious sign. Chaos may be the most obvious sign in the people. The regular signs in youths are fever, hack, and problematic relaxing [3]. Fever is not exactly the symptom of it but various other standard disorders might be absent in ailment wretchedness or the old. Moreover, a hack is frequently absent in children under 2 months old. More genuine signs and signs in children may join blue-contacted skin, hesitance to drink, seizures, advancing heaving, limits of temperature, or a decreased level of mindfulness [4].Subsequently, a chest yield, for instance, x-bars and computer tomography (CT) checks are embraced to all individuals with potential pneumonia results for speedier examination and separation of the corrupted individuals [5].A patient experiencing pneumonia has fast breathing, fever, dry hack, hypertension, and a high heartbeat rate. In the manual test, specialists would check fast breathing, pulse, and high heartbeat rate which could likewise be side effects of weakness, circulatory strain, or essentially hyperpressure. So, there are chances that the specialist is mixing up exhaustion, high BP, and hyperpressure for pneumonia. This cycle of the manual test is right off the bat tedious. Furthermore, it would be deluding such that specialists would botch the genuine minor illness or disease for something genuine as pneumonia. Thirdly, in the manual test, the specialist can commit an error in record keeping or he can miss any minor detail. In the manual test, more staff necessity would cost a ton. The patient’s clinical history would not be known to the specialist. Moreover, the human blunder is consistently impending which would cause the issue. So, as opposed to treating the minor illness, treatment of pneumonia would begin and it would have some results, i.e., some unfavourably susceptible responses and unsettling influence in ordinary metabolic cycles[7].The machine learning algorithm and calculation are basic to create sagacious decisions that will help trained professionals and radiologists to get more information to shield themselves from misdiagnosing a patient. This work looks at open entryways for applying machine learning answers for acknowledgment of pneumonia on chest x-shaft images.The technique is coordinated in three stages. In the essential stage, the principle five x-pillar pictures that are by and large like the patient’s x-bar are recuperated from a lot of reference x-bar pictures using content-based picture recuperation (CBIR) strategy. The CBIR procedure uses midway radon change and Bhattacharya shape likeness measure to manage negligible relative mutilation and, moreover, to enlist the degree of comparability among data and reference CXR pictures independently.In machine learning techniques, methods such as automatic disease detection, artificial neural method, and logistic regression methods are used for the detection of disease. Programmed identification of pneumonia uses the verifiable component of the lung’s airspace [8]. The strategy relies upon the examination of no inflexible deformable selection driven subsequently isolated lungs areas and lungs divided ROI restricted component extraction. Tests performed on 412 chest x-shaft pictures containing 206 standard and 206 pneumonic cases from the chest X-ray 14 dataset suggest that the introduction of the proposed method for the modified revelation of pneumonia using separated lungs is on a very basic level in a manner that is superior to ordinary procedure using full chest x-pillar pictures [9]. The ordinary precision of the method is 3.54% higher than the regular technique. The logistic regression classifier with infection disclosure precision of 95.63% outmaneuvers the other benchmarked classifiers using partitioned lungs locale. Regardless, despite high precision, the system needs more reliable component examination strategies and exhaustive testing on a tremendous number of continuous analyses.Machine learning techniques were not too powerful. These techniques too provided ambiguous results, and to overcome its inefficiency, techniques of deep learning were used. Chest x-beam 23 radiography (CXR) is a quick, viable, and low estimated investigation that distinguishes the attainable COVID-19-related pneumonia. This notice researches the achievability of utilizing a profound becoming acquainted with a 25 based choice tree classifier for identifying COVID-19 from CXR pics. The proposed classifier 26 contains three parallel choice trees, each informed by a profound picking up information on model with convolution 27 neural network dependent on the PyTorch outline. The primary choice tree orders the chest X-ray photos 28 as consistently or uncommon. The 2d tree distinguishes the peculiar depictions that fuse side effects of 29 tuberculosis, though the third does likewise for COVID-19. The exactness of the essential and 30 subsequent option lumber are 98% and 80%, individually, though the basic precision of the 31 third decision tree is 95 [10, 11].In this paper, an enhanced model of restricted Boltzmann machine (named eRBM) is used for detection of pneumonia in x-ray images. The enhancement in the operational procedure of standard RBM has been introduced to eliminate a major drawback of random weight initialization which leads to improper feature learning of the model during the training phase resulting in poor performance of the machine. This modification has introduced significant improvement in the working mechanism of RBM which has increased its power for pneumonia detection process. The rest of paper is organized as follows: Section2 represents the related, Section 3 shows the motivation behind the work, Section 4 shows the working mechanism of standard RBM, and Section 5 consists of the proposed methodology. Experimental setup and results and discussion have been presented in Section 6 and Section 7, respectively, whereas Section 8 shows the conclusion.


## 2. Related Work

Different critics analysed data of pneumonia detection in the researches to find the accuracy, precision, and sensitivity as they used machine learning and deep learning techniques to find out the exact results and accuracy. Comparison with previous researches has also been made by critics. The deep learning technique is more effective for pneumonia detection. Artificial Intelligence technique was also used for pneumonia detection. To find out the accuracy, precision, and sensitivity, characterization of COVID-19, non-COVID-19 viral pneumonia, and bacterial pneumonia were performed based on typical chest x-beams images obtained from online dataset. The dataset incorporates three envelopes (training, approval, and testing with a total scope of 5856 quite horrible cases). The models have been gifted the utilization of 423 COVID-19, 1458 viral pneumonia, and 1579 customary chest x-beam pictures on 2 establishments: (1) growth and (2) without expansion. The designs achieved better correctness, sensitivities, and specificities. Coronavirus, non-COVID-19 viral pneumonia, and bacterial pneumonia were correctly classified with 93% accuracy in our proposed model [12, 13].Logistic regression is used for pneumonia detection. Logistic regression can be used to analyze pneumonia detection. We utilize a logistic regression model to arrange whether or no longer has a given x-beam conveyed pneumonia [14]. Strategic relapse works pleasantly as a gauge because of the reality that it is far beautiful smooth to actualize. For this mission, we mindfulness of the paired kind, attempting to group a particular X-ray as having pneumonia or no more. Pictures from the NIH dataset are 1024 × 1024. Strategic regression genuinely transforms into more prominent memory, serious than deep learning. We utilize a calculated relapse model to the group whether a given x-beam conveys pneumonia. Strategic relapse works pleasantly as a pattern because of the reality it miles quite smooth to place in power. Calculated relapse accomplishes an accuracy rating of 0.60 on the investigate set, utilizing 32 × 32 photographs. Dataset is made solely out of x-ray depictions that are focused inside the zone of view [15].Support vector machine is used for pneumonia detection. To find out the accuracy, precision, and sensitivity, CT photos of a total of 2685 members have been reflectively gathered. In this dataset, multiple times have been the affirmed COVID-19. CT convention comprises of a hundred and twenty kV reproduced chest thickness that goes from 0.625 to 2 mm, with breath safeguard at the full idea. For the proposed approach, we run the model 100 times and found that the most profundity of them was the iteration number 10. The proposed method, named tainting length-mindful irregular woods, incorporates a three-degree decision tree to cut subjects into explicit organizations dependent on the size of aroused sores and dictated via arbitrary timberlands for order in every enterprise. The normal exhibition of the proposed approach was assessed through a 5-crease go-approval. Correlation methodologies comprise strategic relapse (LR), help vector machine (SVM), and neural network (NN). The LR and NN procedures perform further, and SVM has especially lower execution. Results are promising, demonstrating 97% affectability, 83.3% particularity, and 87.9% exactness [16].Stacked autoencoder technique is used for pneumonia detection. To find out the accuracy, precision, and sensitivity, a stacked autoencoder locator adaptation is proposed to upgrade the general exhibition of the recognition models comprising of accuracy cost and remember rate. Our model is electronic with a structure without the need for manage work extraction. The stacked autoencoder locator model can help the forefront clinicians to analyze suspected occasions. Our model accomplishes the normal exactness, accuracy, review, and F1-score pace of 94.7%, 96.54%, 94.1%, and 94.8%, separately [17]. Long short term memory is used for pneumonia detection. To find out the accuracy, precision, and sensitivity, LSTM has the capacity of an RNN in demonstrating time assortment. Time dispersion is utilized with LSTM and the main CNN layer to exchange the images into time arrangement records that are proper for the LSTM shape, and that is seen by utilizing 4 CNN blocks, every one of which fundamentally has a convolutional layer and a bunch standardization layer, and a couple of squares likewise have pooling and dropout layers. This part is for trademark extraction. The characterization component incorporates a straightened layer, two squares of thick dropout layers, and a thick yield layer with a sigmoid initiation trademark that arranges the yield photograph to pneumonia. A freely accessible pneumonia detection dataset of chest x-beams in Kaggle transformed into utilized, which incorporates a total of 5856 pictures caught by methods for an advanced processed radiography (CR) framework. Around 1584 of them are ordinary, and 4273 recommend pneumonia (65% for bacterial pneumonia and 35% for viral pneumonia). A profound learning system for pneumonia characterization with four particular CNN designs was proposed. Two of them were pretalented models, Resnet152v2 and Mobilenetv2, and the others have been planned without any preparation. We assessed the proposed models by contrasting them and later similar examinations. The test execution of our proposed profound Learning System becomes evaluated dependent on exactness, accuracy, F1-rating, remembering, and AUC, and our model affirmed estimations of 99.22%, 99. 43%, 99.44%, 99.44%, and 99.77%, separately. Our proposed Resnet152v2 model finished the best results in examination with the others [18].Neural network was likewise utilized for pneumonia recognition. To discover the exactness, accuracy, and affectability, dataset holds two kinds of chest x-pillar images: normal and pneumonia, which are taken care of in Two Coordinators. In the pneumonia envelope, two kinds of express pneumonia can be seen by the report name: bacteria and virus [19]. Outcomes of seven unequivocal AI estimations: accuracy, AUC, affectability, disposition, and kappa were used to overview the introduction of those seven strategies. RF is the most imperative accuracy ∗rate (0.917), followed by C5.0 (0.912), SVM (0.871), and CART (0.804) [20]. Machine learning techniques were also used for pneumonia clues. To find out the accuracy, precision, and sensitivity, the proposed CAD structure, COVID-19, could decide COVID-pneumonia cases to have an accuracy of 0.965 (sensitivity = 93.54%; specificity = 90.32%; and accuracy = 91.94%) [21, 22]. CNN and MLP were also used for pneumonia detection. To find out the accuracy, precision, and sensitivity, two learning models, neural associations known as CNN and MLP, are depicted, portrayed in the sections underneath. It is possible to see the structure of both neural associations. The course of action of pictures contains 5863 x-pillar pictures and two classes (pneumonia and normal). Chest x-shaft pictures were browsed pediatric patients developed one to five years. For the performance evaulation of the proposed mode, the metrics used to assess the outcomes are precision, recall, TP, TN, and F1 score. The proposed category fashions prove to be the category, with CNN obtaining 94.4% accuracy and MLP with 92.6% [23].


## 3. Motivation

Machine learning and deep learning techniques are applied for pneumonia detection, but still, the need for improvement is required. A restricted Boltzmann machine will be formulized for better accuracy. This model will achieve comparatively better accuracy than other models. An organized deep learning model that will be developed is automatic pneumonia detection. The efficient model would be generated and it will have an advantage in ANN and Deep Learning techniques because a new model is being proposed in this field [24]. Various techniques of Machine Learning are being applied for pneumonia detection to find out the accuracy, precision, and sensitivity. The accuracy of the Logistic Regression technique is 0.60%, Support vector Machine is 87.9%, and K-nearest neighbor technique is 67.5%. The accuracy of these all machine learning techniques is very low and it will affect the whole result. Even a single technique accuracy is not authentic and valid to achieve powerful, reasonable, and acceptable accuracy. Various techniques of Deep Learning are also applied for pneumonia detection to find out the accuracy. The accuracy of the conventional neural network is 92% and MLP is 92.1% and the deep learning algorithm is 73%. The accuracy of these deep learning techniques is very low; it will affect the whole result. These techniques’ results are too not sufficiently reliable to achieve reasonable and acceptable accuracy. In the deep learning technique usually a complex structure is used for pneumonia detection. So, due to the use of complex structure, complexity is increased and there will be overfitting. The training accuracy in overfitting is better but the accuracy of testing is not better because this is only used for memorization and does not understand size patterns. While on the other hand, if we use a simple structure, there will be underfitting [25]. In the case of underfitting, the accuracy for both training and testing datasets is not in an acceptable range. The training and testing in underfitting are not appropriate because underfitting does not recognize the overall pattern. So, we will overcome that problem. We want to create a system that would be neither simple nor complicated. A trial and error mechanism system would be found out which would be without the above problems. Most authors have examined normal and abnormal pneumonia whether it exists or not but could not distinguish between bacterial and viral pneumonia. We will distinguish between bacterial and viral pneumonia [24].


## 4. Restricted Boltzmann Machine for Disease Detection in X-Ray Images

A restricted Boltzmann machine is used for disease detection. It has been used for the detection of several diseases. For example, applied RBM for detection of predicting drug target; RBM model to reasonably encode various wellsprings of information about DTIs and accurately predict different sorts of DTIs, for instance, drug-target associations or prescription strategies for movement.Tests on two public databases showed that our count can achieve astounding gauge execution with high AUPR scores. Further tests indicated that our procedure can infer a once-over of novel DTIs, which is useful for drug repositioning. Disregarding the way that our figuring has been attempted particularly on quick and abnormal medicine target associations, and three prescription strategies for movement, it is general and can be easily loosened up to organize various kinds of DTIs (for instance, phenotypic effects). Tests on two public databases show that our kept Boltzmann machine model can satisfactorily get the inert features of a DTI put together and achieve brilliant execution on predicting different sorts of DTIs, with the area under precision survey twist up to 89.6. These results show that our system can have significantly sensible relevance to DTI Figures1 and 2 and prescription repositioning and hence advance the drug exposure measure [26].Figure 1
Comparison between normal and viral and bacterial pneumonia alveoli after x-ray detection [6].Figure 2
Chest x-ray images used for disease detection.Applied RBM for detection of breast cancer classification, we have built a deep neural network (DNN) model using a limited Boltzmann machine with “scaled form angle” back propagation to order a bunch of histopathological bosom disease pictures [27]. His calculation does not matter any preprocessing ventures before highlight extraction. Calculation 1 straightforwardly removes Tamura highlights from each picture, and the highlights are taken care of to the proposed model of the limited Boltzmann machine (RBM) for picture order. In the prepreparing steps, this calculation improves the differentiation of each picture in the dataset utilizing the proposed contrast-upgrade calculation and afterward extricates the highlights. After that, all the highlights are taken care of to the proposed model of the restricted Boltzmann machine (RBM) for picture arrangement [28]. As a profound learning device, we have executed an unaided limited Boltzmann machine that contains four layers and is guided by a managed back proliferation strategy. For the back-spread, scaled form angle methods have been used.We have played out our examinations on the Break His dataset and got 88.7%, 85.3%, 88.6%, and 88.4% precision for the dataset of 40X, 100X, 200X, and 400X amplification factors, individually. The vast majority of the investigations on the Break His dataset decided for the exhibition based on exactness; in any case, in this section, we have additionally considered TPR and FPR esteems alongside a point by point depiction of the ROC bends [29].Input:RBMv1,....,vm,h1,....,hn,trainingbatchS,Output:gradient approximationΔoij,Δoj2,Δoj3fori=1..........,n,j=1,......,m,(1)
initΔoij=Δoi2=Δoi=0fori=1,.......,n,j=1,......,m(2)
for all thev∈sdo(3)
v0←v(4)
fort=0,.......,k−1do(5)
fori=1,.......,ndo samplehit∼phi|vt(6)
forj=1,.......,mdo samplevjt+1∼pvj|ht(7)
fori=1,.......,n,j=1,......,mdo(8)
Δoij←Δoij+phi−1|v0.vj0−phi=1|vk.vjk(9)
Δoj←Δoj+vj0−vjk(10)
Δoi←Δoi+phi=1|v0−phi=1|vkApplied RBM for detection of brain disorder detection: in-depth learning approaches can naturally extricate information attributes to take care of the issue of removing qualities through their various levelled structures. In this paper, an improved deep belief network (DBN)-based picture grouping model has been proposed by consolidating the Discrete Wavelet Change (DWT) for highlight extraction and principal component analysis (PCA) to get a diminished size of separated highlights. Here, the DBN is made out of stacked restricted Boltzmann machines (RBMs) to mine the huger highlights from the decreased datasets layer by layer. For the most part, DBN requires immense and various shrouded layers with an enormous number of concealed units to take in the best highlights from the crude pixels of picture information. This builds the intricacy just as preparing time for the model. Thus, by combining DBN with DWT, both time efficiency has been improved. But, utilizing crude pictures, the separated low-goal picture from DWT is utilized for preparing DBN [30].Applied RBM for detection of hypertension retinopathy: hypertensive retinopathy (HR) in the layer of the eye is aggravation brought about by hypertension illness, where there is a basic change of blood vessel in the veins of the retina. Most cardiovascular failures happen in patients brought about by hypertension manifestations of undiscovered. The symptoms of hypertensive retinopathy, for example, are arteriolar narrowing, retinal discharge, and cotton fleece spots. Given these reasons, the early analysis of the manifestations of hypertensive retinopathy is extremely dire to point the counteraction and treatment more exactly. This exploration means building up a framework for early recognition of hypertension retinopathy stage. The proposed technique is to decide the consolidated highlights corridor and vein width proportion (AVR) just as change position with Optic Disk (OD) in retinal pictures to inspect the characterization of hypertensive retinopathy utilizing Deep Neural Networks (DNN) and Boltzmann machines approach. It expected outcomes from this examination which planned a model framework early identification of hypertensive retinopathy stage and broke down the adequacy and precision of the suggested techniques [31].Applied RBM for detection of blood transfusion prediction: the accessibility of blood bonding has been a repetitive worry for clinical organizations and patients. Effective administration of this asset speaks to a significant test for some medical clinics. Similarly, fast response during bonding choices and arranging is a basic factor to expand understanding consideration. This paper proposes a novel system for anticipating the blood bonding need, in light of accessible data, by methods for restricted Boltzmann machines (RBM). By removing and investigating significant level highlights from 4831 patient records, RBM can manage complex examples acknowledgment, helping directed classifiers in the errand of programmed recognizable proof of blood bonding necessities. Results show that an effective characterization is acquired (96.85%), in light of accessible data from the patient records [32].


## 5. Proposed Methodology

The proposed methodology consists of four steps, (i) read images, (ii) image preprocessing, (iii) classification (differentiated viral-induced pneumonia, bacterial-induced pneumonia, and normal lungs), and (vi) performance evaluation.The four steps are followed in this section. The proposed methodology is shown in Figure3.Figure 3
A systematic block diagram has been drawn in which the RBM method is used after taking x-ray images for pneumonia detection.


### 5.1. Image Acquisition

In this stage, the images of normal and abnormal lungs have been retrieved from the database for possible procedural operations. The data are then profitably split into the Train, Test, and Val: Train contains the readiness data/pictures for demonstrating our model. Val contains pictures that we will use to support our model. Test contains the data that we use to test the model at whatever point it has taken in the associations between the photos and their name (Pneumonia/not Pneumonia). The train dataset is the portion of the dataset that has been used for training our proposed model. A total of 1500 lung images have been considered for experimentation. Out of these 1500 images, 500 images are normal and 1000 images are abnormal having pneumonia. Out of the 1000 abnormal images, 500 are bacterial pneumonia, whereas 500 are viral pneumonia.


### 5.2. Image Preprocessing

The image preprocessing is completed in three stages: Step 1: all the images, initially procured, were first looked at to locate the base tallness and width present in the dataset pictures. After discovering this base measurement, all the dataset pictures were resized to this measurement. Step 2: prehandling of resized pictures is finished by the Image-Net information base. Image-Net information base is an openly accessible PC vision dataset containing a great many pictures with more than a thousand picture classes. Step 3: preprocessing is the way toward improving or upgrading the nature of the information picture and making the element extraction stage more dependable; principle thought process of preprocessing stages is to eliminate clamor present in info picture. In the preprocessing stage middle channel is utilized to eliminate commotion from the info picture and for picture upgrade, power-law changes have been utilized.


### 5.3. Classification

The classifier is a numerical capacity that is executed utilizing characterization calculation which guides input information to a specific classification. A limited Boltzmann machine is a stochastic neural organization comprised of two layers: one of obvious and one of the shrouded units. There are various arrangements of the preparation network that we did not test and could improve the grouping score. To start with, we have just utilized contrastive disparity in one stage; however, this could be changed to a self-assertive number. Second, various calculations could be tried to prepare the confined Boltzmann machine, one of them being tireless contrastive dissimilarity. We additionally accept that utilizing more layers of limited Boltzmann machine could likewise improve recognition. Notwithstanding, this strategy may accompany the expense of more memory use and an expanded testing time. A standard RBM is a generative model with two densely connected layers, one visible layer to represent data and the second is a latent layer to extract stochastic binary features from data. Hidden units are connected to visible nodes using symmetrically weighted connections to model their joint distribution. The bacterial disease is profoundly likely in instances of youth local area obtained pneumonia with alveolar invades on the chest radiograph. Interstitial invades are seen in both viral and bacterial pneumonia. Except for serum CRP levels, routine hematological tests have next to no functional incentive notwithstanding a chest radiograph. All kids with radiologically affirmed pneumonia ought to be treated with antitoxins because, in medical practice, it is difficult to identify only between viral pneumonia and bacterial pneumonia.RBM is a Stochastic Neural Network which means that each neuron has some disorder behaviour when it is activated. There are two other layers of bias unit's hidden prejudice and visible prejudice in RBM. Input/visible layers consist of different chest x-ray images of pneumonia the hidden layer consists of four classifiers like normal, abnormal bacterial, and viral as shown in Figure4. The hidden prejudice RBM produces the activation on the forward pass and the visible bias helps RBM to reconstruct the input during a backward pass. The reconstructed input is always different from the actual input because there are no connections among the visible units therefore there is no way of transferring information between them. We are reconstructing the input layer through the activated hidden state instead of calculating the output layer. This process is called be Feed Backward Pass. Backtracking the input layer is activated through hidden neurons. After performing this, an input is reconstructed through the activated hidden state as shown in Figure 5. Let us consider an example in which we have some assumptions that V1 visible unit activates the h1 and h2 hidden unit and the V2 visible unit activates the h2 and h3 hidden. Now when any new visible unit lets V4 come into the machine and it also activates the h1 and h2 units. So, we can back discover the hidden unit easily and also can identify that the characteristics of the new V4 neuron are matching with the V1. This is because the V1 is also activated in the same hidden unit earlier.(1)Ev,h,θ=−∑i∈visiblebivi−∑j∈hiddencihi−∑i,jvihjwij.Figure 4
Pneumonia detection is in chest X-ray images using RBM.Figure 5
The graph of an RBM with hidden and visible variables.The value of the joint probability model for the event of paired vector (v, h):(2)Pv,h=1ze−Ev,h,where Z is given by summing overall possible pairs of the visible and hidden layers.(3)z=∑v,he−Ev,h,where Z is also called a partition function.(4)Pv=1z∑he−Ev,h,InLθ|v=InPv|θ,=In1z∑he−Ev,h,In∑he−Ev,h−In∑v,heEv,h.The method which has been proposed in this paper is the conversion of initial weightsWij which are defined indiscriminately. In this method, the worth of Wij is replaced according to the difference between the mean values of all features of the set of training vectors v∈s,V_i, and the mean of all the values of the features of the training vectors V_. In other words, if the substance Vi_ is more than V_ weight obtaining Wij is required. This paper shows that this work exceeds the coincidence of producing a training set of vectors vv ∈ sS by the restricted Boltzmann machine. The main thing in this procedure is the initial weight being confined indiscriminately. Thus, the use of a disorderly starting point in this procedure is observed. According to this approach, the conversion of Wij is based on the comparison of V¯i=1/∑l=1Lvli,andV¯=1/N×L∑i=1N∑K=1LLvil ،, where 1 ≤ i ≤ N. Parameter L is the number of training vectors. According to the model in this procedure, we have solved on one hand to put the quantity of energy model for all visible and hidden node arrangement ∑v,he−Ev,h in a continuous manner and while on the other hand to decrease the quantity of energy for all feasible values in the hidden layer and the training vector v, ∑he−Ev,h[33].(5)lnv∈sℒθ|v=ln1L∑v∈sℒθ|v,=ln1L∑v∈s∑h−Ev,h−In1L∑v∈s∑v,he−Ev,h,=In1L∑v∈s∑h−Ev,h−In1L×L∑v,he−Ev,h.Based on the results, we can easily deduce equations.(6)lnv∈sℒθ|v=ln1L∑v∈s∑he−Ev,h−ln∑v,he−Ev,h,lnv∈sLθ|v=ln1L∑v∈s∑he−Ev,h−ln∑v,he−Ev,h.In the second intermission of the right side of the equation, the valuee−Ev,h is counted for all arrangements of the hidden and visible layer. We can draw a result from the equation that the deduction of energy between all nodes of the hidden layer and visible training vectors results in the process of the similarity between feasible model and the parameter in the training vectors set v ∈ S. In the proposed procedure, the preliminary weights are replaced to proceed the coincidence of restoration of a set of training vectors by model. However, prejudice values of hidden and viable layers remain unchanged. To replace the weight Wij between all nodes of the hidden layer and all nodes of the visible layer in the θ′ restricted Boltzmann machine model is defined as follows:(7)Wij=Wij+Vj−−V−,WhereVj−=∑lLvjl,V−=∑j=1L∑Vl=1LL×m,where Wij means the weight replacement should be on the side that exceeds the chance of regenerating the training samples in the feasible restricted Boltzmann model. The replacement of weight is done in a manner that on one side, it could keep consistent the amount of energy of the model for all visible and concealed layers manner, and on the other side, it could deduct the amount of energy for all values in the concealed layer and the training vector. In the following, we try to show in this paper that by replacing the initial values of the weight matrix W to the proposed procedure, the amount ∑v,he−Ev,h is not exchanged.The values of bias hidden layer and the bias visible layers are the same in both restricted Boltzmann machines ofθ and θ′. We can rewrite the elements of sum replaced weight matrix, W, based on the initial weight matrix, W [33].(8)∑i=1n∑j=1mWij=∑i=1nWi1+V¯1−V¯+Wi2+V¯2−V¯+⋯Wim+V¯m−V¯,⟶∑i=1n∑j=1mWij=W11+V¯1−V¯+W12+V¯2−V¯+.....+W2m+V¯m−V¯,W11+V¯1−V¯+W12+V¯2−V¯+.....+Wim+V¯m−V¯+W21+V¯1−V+.....+Wmm+V¯m−V¯,⟶∑i=1n∑j=1mWij=∑i=1n∑j=1mWij+m×V¯1+V¯2+...V¯m−V¯.Then, in consideration of the equations, the following results are obtained:(9)∑i=1n∑j=1mWij+m×V¯1+⋯+V¯m−V¯=∑i=1n∑j=1mWij+∑j=1m∑lLVjlL×m→∑i=1n∑j=1mWij=∑i=1n∑j=1mWij.


### 5.4. Performance Evaluation

Execution of the proposed two-stage pneumonia location framework is assessed factual estimates such as exactness, accuracy, and review [34]. These measures are quickly depicted as follows.


#### 5.4.1. Confusion Matrix

A confusion matrix is shaped from the four results; a classifier assumes all information occurrences of a test dataset as positive or negative. This classification or assumption produces four results: positive true, true negative, false positive, and false negative.True positive: correct positive predictionFalse positive: incorrect positive predictionTrue negative: correct negative predictionFalse negative: incorrect negative prediction


#### 5.4.2. Accuracy

It is a boundary that evaluates the capacity of a technique by estimating a ratio of accurately anticipated cases out of a complete number of cases. Numerically, it is expressed as(10)accuracy=TP+TNTP+FP+FN+TN,where TP is the number of right forecasts of positive cases by the strategy; TN is the number of right expectations of negative cases by the technique; FP is the number of mistaken expectations of positive cases by the strategy; and TN is the number of incorrect forecasts of negative cases by the technique. In this way, validity is not in every case great to evaluate the display of the model specifically if there should be an occurrence of the asymmetrical dataset. Consequently, there is a need to assess the other execution measurements to test the model.


#### 5.4.3. Precision

It is the proportion of correctly anticipated positive cases to the complete anticipated positive cases. High validity identifies with the low false positive rate. It is expressed as(11)precision=TPTP+FP.


#### 5.4.4. Recall or Sensitivity

It is the proportion of accurately predicted positive inspections to all observations in the actual class.(12)Recall=TPTP+FN.


#### 5.4.5. Specificity

It is the proportion of accurately predicted negative inspections to all the actual negative observations.(13)Specificity=TNFP+TN.


#### 5.4.6.F1-Score

The measurements ofF1-score in case of uneven class division particularly with a large number of true negative inspections: it supplies a balance between validity and recall [35].(14)F1−score=2∗precision∗recallprecision+recall.


## 5.1. Image Acquisition

In this stage, the images of normal and abnormal lungs have been retrieved from the database for possible procedural operations. The data are then profitably split into the Train, Test, and Val: Train contains the readiness data/pictures for demonstrating our model. Val contains pictures that we will use to support our model. Test contains the data that we use to test the model at whatever point it has taken in the associations between the photos and their name (Pneumonia/not Pneumonia). The train dataset is the portion of the dataset that has been used for training our proposed model. A total of 1500 lung images have been considered for experimentation. Out of these 1500 images, 500 images are normal and 1000 images are abnormal having pneumonia. Out of the 1000 abnormal images, 500 are bacterial pneumonia, whereas 500 are viral pneumonia.


## 5.2. Image Preprocessing

The image preprocessing is completed in three stages: Step 1: all the images, initially procured, were first looked at to locate the base tallness and width present in the dataset pictures. After discovering this base measurement, all the dataset pictures were resized to this measurement. Step 2: prehandling of resized pictures is finished by the Image-Net information base. Image-Net information base is an openly accessible PC vision dataset containing a great many pictures with more than a thousand picture classes. Step 3: preprocessing is the way toward improving or upgrading the nature of the information picture and making the element extraction stage more dependable; principle thought process of preprocessing stages is to eliminate clamor present in info picture. In the preprocessing stage middle channel is utilized to eliminate commotion from the info picture and for picture upgrade, power-law changes have been utilized.


## 5.3. Classification

The classifier is a numerical capacity that is executed utilizing characterization calculation which guides input information to a specific classification. A limited Boltzmann machine is a stochastic neural organization comprised of two layers: one of obvious and one of the shrouded units. There are various arrangements of the preparation network that we did not test and could improve the grouping score. To start with, we have just utilized contrastive disparity in one stage; however, this could be changed to a self-assertive number. Second, various calculations could be tried to prepare the confined Boltzmann machine, one of them being tireless contrastive dissimilarity. We additionally accept that utilizing more layers of limited Boltzmann machine could likewise improve recognition. Notwithstanding, this strategy may accompany the expense of more memory use and an expanded testing time. A standard RBM is a generative model with two densely connected layers, one visible layer to represent data and the second is a latent layer to extract stochastic binary features from data. Hidden units are connected to visible nodes using symmetrically weighted connections to model their joint distribution. The bacterial disease is profoundly likely in instances of youth local area obtained pneumonia with alveolar invades on the chest radiograph. Interstitial invades are seen in both viral and bacterial pneumonia. Except for serum CRP levels, routine hematological tests have next to no functional incentive notwithstanding a chest radiograph. All kids with radiologically affirmed pneumonia ought to be treated with antitoxins because, in medical practice, it is difficult to identify only between viral pneumonia and bacterial pneumonia.RBM is a Stochastic Neural Network which means that each neuron has some disorder behaviour when it is activated. There are two other layers of bias unit's hidden prejudice and visible prejudice in RBM. Input/visible layers consist of different chest x-ray images of pneumonia the hidden layer consists of four classifiers like normal, abnormal bacterial, and viral as shown in Figure4. The hidden prejudice RBM produces the activation on the forward pass and the visible bias helps RBM to reconstruct the input during a backward pass. The reconstructed input is always different from the actual input because there are no connections among the visible units therefore there is no way of transferring information between them. We are reconstructing the input layer through the activated hidden state instead of calculating the output layer. This process is called be Feed Backward Pass. Backtracking the input layer is activated through hidden neurons. After performing this, an input is reconstructed through the activated hidden state as shown in Figure 5. Let us consider an example in which we have some assumptions that V1 visible unit activates the h1 and h2 hidden unit and the V2 visible unit activates the h2 and h3 hidden. Now when any new visible unit lets V4 come into the machine and it also activates the h1 and h2 units. So, we can back discover the hidden unit easily and also can identify that the characteristics of the new V4 neuron are matching with the V1. This is because the V1 is also activated in the same hidden unit earlier.(1)Ev,h,θ=−∑i∈visiblebivi−∑j∈hiddencihi−∑i,jvihjwij.Figure 4
Pneumonia detection is in chest X-ray images using RBM.Figure 5
The graph of an RBM with hidden and visible variables.The value of the joint probability model for the event of paired vector (v, h):(2)Pv,h=1ze−Ev,h,where Z is given by summing overall possible pairs of the visible and hidden layers.(3)z=∑v,he−Ev,h,where Z is also called a partition function.(4)Pv=1z∑he−Ev,h,InLθ|v=InPv|θ,=In1z∑he−Ev,h,In∑he−Ev,h−In∑v,heEv,h.The method which has been proposed in this paper is the conversion of initial weightsWij which are defined indiscriminately. In this method, the worth of Wij is replaced according to the difference between the mean values of all features of the set of training vectors v∈s,V_i, and the mean of all the values of the features of the training vectors V_. In other words, if the substance Vi_ is more than V_ weight obtaining Wij is required. This paper shows that this work exceeds the coincidence of producing a training set of vectors vv ∈ sS by the restricted Boltzmann machine. The main thing in this procedure is the initial weight being confined indiscriminately. Thus, the use of a disorderly starting point in this procedure is observed. According to this approach, the conversion of Wij is based on the comparison of V¯i=1/∑l=1Lvli,andV¯=1/N×L∑i=1N∑K=1LLvil ،, where 1 ≤ i ≤ N. Parameter L is the number of training vectors. According to the model in this procedure, we have solved on one hand to put the quantity of energy model for all visible and hidden node arrangement ∑v,he−Ev,h in a continuous manner and while on the other hand to decrease the quantity of energy for all feasible values in the hidden layer and the training vector v, ∑he−Ev,h[33].(5)lnv∈sℒθ|v=ln1L∑v∈sℒθ|v,=ln1L∑v∈s∑h−Ev,h−In1L∑v∈s∑v,he−Ev,h,=In1L∑v∈s∑h−Ev,h−In1L×L∑v,he−Ev,h.Based on the results, we can easily deduce equations.(6)lnv∈sℒθ|v=ln1L∑v∈s∑he−Ev,h−ln∑v,he−Ev,h,lnv∈sLθ|v=ln1L∑v∈s∑he−Ev,h−ln∑v,he−Ev,h.In the second intermission of the right side of the equation, the valuee−Ev,h is counted for all arrangements of the hidden and visible layer. We can draw a result from the equation that the deduction of energy between all nodes of the hidden layer and visible training vectors results in the process of the similarity between feasible model and the parameter in the training vectors set v ∈ S. In the proposed procedure, the preliminary weights are replaced to proceed the coincidence of restoration of a set of training vectors by model. However, prejudice values of hidden and viable layers remain unchanged. To replace the weight Wij between all nodes of the hidden layer and all nodes of the visible layer in the θ′ restricted Boltzmann machine model is defined as follows:(7)Wij=Wij+Vj−−V−,WhereVj−=∑lLvjl,V−=∑j=1L∑Vl=1LL×m,where Wij means the weight replacement should be on the side that exceeds the chance of regenerating the training samples in the feasible restricted Boltzmann model. The replacement of weight is done in a manner that on one side, it could keep consistent the amount of energy of the model for all visible and concealed layers manner, and on the other side, it could deduct the amount of energy for all values in the concealed layer and the training vector. In the following, we try to show in this paper that by replacing the initial values of the weight matrix W to the proposed procedure, the amount ∑v,he−Ev,h is not exchanged.The values of bias hidden layer and the bias visible layers are the same in both restricted Boltzmann machines ofθ and θ′. We can rewrite the elements of sum replaced weight matrix, W, based on the initial weight matrix, W [33].(8)∑i=1n∑j=1mWij=∑i=1nWi1+V¯1−V¯+Wi2+V¯2−V¯+⋯Wim+V¯m−V¯,⟶∑i=1n∑j=1mWij=W11+V¯1−V¯+W12+V¯2−V¯+.....+W2m+V¯m−V¯,W11+V¯1−V¯+W12+V¯2−V¯+.....+Wim+V¯m−V¯+W21+V¯1−V+.....+Wmm+V¯m−V¯,⟶∑i=1n∑j=1mWij=∑i=1n∑j=1mWij+m×V¯1+V¯2+...V¯m−V¯.Then, in consideration of the equations, the following results are obtained:(9)∑i=1n∑j=1mWij+m×V¯1+⋯+V¯m−V¯=∑i=1n∑j=1mWij+∑j=1m∑lLVjlL×m→∑i=1n∑j=1mWij=∑i=1n∑j=1mWij.


## 5.4. Performance Evaluation

Execution of the proposed two-stage pneumonia location framework is assessed factual estimates such as exactness, accuracy, and review [34]. These measures are quickly depicted as follows.


### 5.4.1. Confusion Matrix

A confusion matrix is shaped from the four results; a classifier assumes all information occurrences of a test dataset as positive or negative. This classification or assumption produces four results: positive true, true negative, false positive, and false negative.True positive: correct positive predictionFalse positive: incorrect positive predictionTrue negative: correct negative predictionFalse negative: incorrect negative prediction


### 5.4.2. Accuracy

It is a boundary that evaluates the capacity of a technique by estimating a ratio of accurately anticipated cases out of a complete number of cases. Numerically, it is expressed as(10)accuracy=TP+TNTP+FP+FN+TN,where TP is the number of right forecasts of positive cases by the strategy; TN is the number of right expectations of negative cases by the technique; FP is the number of mistaken expectations of positive cases by the strategy; and TN is the number of incorrect forecasts of negative cases by the technique. In this way, validity is not in every case great to evaluate the display of the model specifically if there should be an occurrence of the asymmetrical dataset. Consequently, there is a need to assess the other execution measurements to test the model.


### 5.4.3. Precision

It is the proportion of correctly anticipated positive cases to the complete anticipated positive cases. High validity identifies with the low false positive rate. It is expressed as(11)precision=TPTP+FP.


### 5.4.4. Recall or Sensitivity

It is the proportion of accurately predicted positive inspections to all observations in the actual class.(12)Recall=TPTP+FN.


### 5.4.5. Specificity

It is the proportion of accurately predicted negative inspections to all the actual negative observations.(13)Specificity=TNFP+TN.


### 5.4.6.F1-Score

The measurements ofF1-score in case of uneven class division particularly with a large number of true negative inspections: it supplies a balance between validity and recall [35].(14)F1−score=2∗precision∗recallprecision+recall.


## 5.4.1. Confusion Matrix

A confusion matrix is shaped from the four results; a classifier assumes all information occurrences of a test dataset as positive or negative. This classification or assumption produces four results: positive true, true negative, false positive, and false negative.True positive: correct positive predictionFalse positive: incorrect positive predictionTrue negative: correct negative predictionFalse negative: incorrect negative prediction


## 5.4.2. Accuracy

It is a boundary that evaluates the capacity of a technique by estimating a ratio of accurately anticipated cases out of a complete number of cases. Numerically, it is expressed as(10)accuracy=TP+TNTP+FP+FN+TN,where TP is the number of right forecasts of positive cases by the strategy; TN is the number of right expectations of negative cases by the technique; FP is the number of mistaken expectations of positive cases by the strategy; and TN is the number of incorrect forecasts of negative cases by the technique. In this way, validity is not in every case great to evaluate the display of the model specifically if there should be an occurrence of the asymmetrical dataset. Consequently, there is a need to assess the other execution measurements to test the model.


## 5.4.3. Precision

It is the proportion of correctly anticipated positive cases to the complete anticipated positive cases. High validity identifies with the low false positive rate. It is expressed as(11)precision=TPTP+FP.


## 5.4.4. Recall or Sensitivity

It is the proportion of accurately predicted positive inspections to all observations in the actual class.(12)Recall=TPTP+FN.


## 5.4.5. Specificity

It is the proportion of accurately predicted negative inspections to all the actual negative observations.(13)Specificity=TNFP+TN.


## 5.4.6.F1-Score

The measurements ofF1-score in case of uneven class division particularly with a large number of true negative inspections: it supplies a balance between validity and recall [35].(14)F1−score=2∗precision∗recallprecision+recall.


## 6. Experimental Setup

### 6.1. Running Environment

The whole experimentation was performed on Windows 10 operating system with Python 3.8.6 installed on it. Different types of environments and libraries of Python for deep learning models were used for supporting the experimental setup. The main libraries and tools of Python that supported the experimentation include Numphy, Scipy, Anaconda, TensorFlow, Spyder IDE, and Pycharm. These all were used for different purposes to improve the execution process. The parameters of RBM used are as follows: a restricted Boltzmann machine with binary visible units and binary hidden units. Parameters are estimated using stochastic maximum likelihood (SML), also known as persistent contrastive divergence (PCD) [36]. The number of hidden units has set to its default value that is 256, whereas the learning rate value is 0.1. The batch size has been set to 10, whereas the number of iterations has been varied from 10 to 50 with and increment of 5 to evaluate the performance for different iterations. The verbosity level value has been kept as 0 which shows the silent mode. Further, the biases values of intercept visible and intercept hidden units have been set to the default values of the model.


### 6.2. Data Specification and Division

The proposed model was applied to three different datasets all containing pneumonia with the following details. The data were divided into 70 and 30 ratio for training and testing, respectively, as shown in Table1.(1)
Dataset 1. Total images: 1500, normal images = 500, and abnormal images = 1000 (bacterial pneumonia = 500; viral pneumonia = 500) [37].(2)
Dataset 2. Total images: 3000, normal images = 1000, COVID-19 images = 1000, and pneumonia images = 1000 [38].(3)
Dataset 3. Total = 1248, normal 500, COVID pneumonia 215, and non-COVID pneumonia 533 [39].Table 1
Description of datasets.
Total training samplesTotal testing samplesTraining samplesTesting samplesDataset 1NormalBacterialViralNormalBacterialViral1050450350350350150150150Dataset 2NormalCOVID-19PneumoniaNormalCOVID-19Pneumonia2100900700700700300300300Dataset 3NormalCOVID-pneumoniaNon-COVID-pneumoniaNormalCOVID-pneumoniaNon-COVID-pneumonia874374350150374150165159


## 6.1. Running Environment

The whole experimentation was performed on Windows 10 operating system with Python 3.8.6 installed on it. Different types of environments and libraries of Python for deep learning models were used for supporting the experimental setup. The main libraries and tools of Python that supported the experimentation include Numphy, Scipy, Anaconda, TensorFlow, Spyder IDE, and Pycharm. These all were used for different purposes to improve the execution process. The parameters of RBM used are as follows: a restricted Boltzmann machine with binary visible units and binary hidden units. Parameters are estimated using stochastic maximum likelihood (SML), also known as persistent contrastive divergence (PCD) [36]. The number of hidden units has set to its default value that is 256, whereas the learning rate value is 0.1. The batch size has been set to 10, whereas the number of iterations has been varied from 10 to 50 with and increment of 5 to evaluate the performance for different iterations. The verbosity level value has been kept as 0 which shows the silent mode. Further, the biases values of intercept visible and intercept hidden units have been set to the default values of the model.


## 6.2. Data Specification and Division

The proposed model was applied to three different datasets all containing pneumonia with the following details. The data were divided into 70 and 30 ratio for training and testing, respectively, as shown in Table1.(1)
Dataset 1. Total images: 1500, normal images = 500, and abnormal images = 1000 (bacterial pneumonia = 500; viral pneumonia = 500) [37].(2)
Dataset 2. Total images: 3000, normal images = 1000, COVID-19 images = 1000, and pneumonia images = 1000 [38].(3)
Dataset 3. Total = 1248, normal 500, COVID pneumonia 215, and non-COVID pneumonia 533 [39].Table 1
Description of datasets.
Total training samplesTotal testing samplesTraining samplesTesting samplesDataset 1NormalBacterialViralNormalBacterialViral1050450350350350150150150Dataset 2NormalCOVID-19PneumoniaNormalCOVID-19Pneumonia2100900700700700300300300Dataset 3NormalCOVID-pneumoniaNon-COVID-pneumoniaNormalCOVID-pneumoniaNon-COVID-pneumonia874374350150374150165159


## 7. Results and Discussion

In order to evaluate the performance of the proposed model adequately, the model was applied to three different datasets, as shown in Table1. The comparison of the model with other state of the art techniques in terms of classification accuracy, precision, recall, specificity, F1-score, and ROC curve is presented in this section with sufficient detail.As revealed in Table2, the model shows the accuracy of enhanced RBM 97.90, and in standard, RBM is 94.85 and other techniques have different accuracies. The results show that the accuracy of enhanced RBM is more than standard RBM as well as all other standard models. In this way, if you observe precision, recall/sensitivity, specificity, and F1-score, then it can be concluded that the model shows substantial improvement in enhanced RBM.Table 2
Dataset 1: training samples.
ModelAccuracyPrecisionRecallSpecificityF1-scoreKNN92.610.93180.93870.94132.5432SVM90.710.91710.92240.91732.1879DT91.540.92130.93110.93442.4316sRBM94.850.97320.98490.97392.9548eRBM97.900.97680.99120.97742.9636Bold values highlight the performance of our model, i.e., Restricted Boltzmann Machine.Figure6 shows the ROC curve of the proposed model (enhanced RBM) in comparison with other classifiers considered. Although there are many fluctuations in the curve, but overall, the true positive rate of eRBM is better than all other models.Figure 6
ROC curve of the proposed model (enhanced RBM) in comparison with other classifiers considered for training of dataset 1.Table3 shows the comparison of eRBM with sRBM, KNN, SVM, and decision tree in terms of classification accuracy, precision, recall, specificity, and F1-score. For all the performance evaluation parameters, a considerable improvement can be observed in the performance of the proposed model. The result in the improvement is due to the enhancement introduced in the standard operational working mechanism of standard RBM. If keenly observed, the performance of all the models for this testing dataset is slightly worse than that of training dataset. This is due to overfitting problem in which the model usually gives better results on training dataset than the testing dataset.Table 3
Dataset 1: testing samples.
ModelAccuracyPrecisionRecallSpecificityF1-scoreKNN89.340.92170.89420.92862.6973SVM86.550.87530.85210.87772.2286DT87.650.91130.88220.90752.6437sRBM90.220.95680.93660.95712.8973eRBM96.660.98630.97970.98592.9391Bold values highlight the performance of our model, i.e., Restricted Boltzmann Machine.Figure7 shows the ROC of the eRBM in comparison with other state of the art classification models. The figure shows that the highest true positive rate has been observed for the eRBM followed by the rate of standard RBM. There are some variations in the true positive rates of all other models considered. If the ROCs of the training and testing datasets are deeply observed, it can be easily concluded that the true positive rate of training dataset is slightly higher than the rate of testing dataset.Figure 7
ROC of the eRBM in comparison with other state of the art classification models for testing of dataset 1.The performance of the proposed model for training dataset of the second dataset is shown in Table4. The highest classification accuracy, precision, recall, specificity, and F1-score have been observed for the eRBM followed by standard RBM. For all other classification techniques, there are some variations in the results. For example, the classification accuracy of KNN is higher than decision tree but the precision of decision tree is higher than that of KNN. The table shows that the performance of SVM is better than KNN and decision tree but poor than standard RBM and eRBM for all the considered evaluation parameters.Table 4
Dataset 2: training samples.
ModelAccuracyPrecisionRecallSpecificityF1-scoreKNN93.710.93890.95230.95622.7667SVM94.430.95120.96110.96412.8123DT93.330.94480.95270.95212.7827sRBM96.490.98860.98330.98222.9711eRBM99.300.99710.99890.98952.9879Bold values highlight the performance of our model, i.e., Restricted Boltzmann Machine.Figure8 shows the ROC of eRBM in comparison with other approaches considered for training dataset of the second dataset. The highest positive rate has been observed for the eRBM followed by the standard RBM. If this is keenly observed, the true positive rate for all the models is better than that of training samples of dataset 1.Figure 8
ROC of eRBM in comparison with other approaches considered for training of the dataset 2.Table5 shows the comparison of the eRBM with other approaches considered to evaluate the performance of the model in terms of accuracy, precision, recall, specificity, and F1-score for testing samples of dataset 2. For all the outlined parameters, the performance of the eRBM is better than all the other models. If this testing dataset performance is compared with the training dataset, it can be concluded that the performance of all models for testing dataset is slightly worse than that of training dataset.Table 5
Dataset 2: testing samples.
ModelAccuracyPrecisionRecallSpecificityF1-scoreKNN91.640.92730.92660.94682.7391SVM92.620.93680.94660.94652.7951DT88.770.87890.88370.88622.6525sRBM97.530.97550.97410.96952.9611eRBM98.560.98970.98780.98862.9754Bold values highlight the performance of our model, i.e., Restricted Boltzmann Machine.Figure9 shows the ROC comparison of the proposed model with other state of the art models. As shown in the figure, the true positive rate of eRBM is higher than all the other models showing the strength of the improvements introduced in the working mechanism of standard RBM. A sufficient amount of difference can be observed in the performance of eRBM as compared to other classifiers. If the ROCs of both training and testing samples of dataset 2 are keenly observed, it can be concluded that true positive rate for all the models of testing samples is slightly lower than training data samples.Figure 9
ROC comparison of the proposed model with other state of the art models for testing of dataset 2.Table6 shows the performance evaluation parameters for training samples of dataset 3 for the eRBM and other classifiers. The highest accuracy has been observed for eRBM followed by sRBM, KNN, decision tree, and SVM, respectively. In the same way, similar observations can be found for other parameters as well. For all parameters, the performance of eRBM is better than all other approaches, whereas for other models, variations can be observed in the results. If the results are deeply observed, it can be concluded that performance of all models for dataset 3 is worse than the other datasets. The reason is the small amount of both training and testing samples as outlined in the dataset specification and descriptions.Table 6
Dataset 3: training samples.
ModelAccuracyPrecisionRecallSpecificityF1-scoreKNN89.640.88650.87480.88552.3214SVM86.320.85450.85340.86121.8953DT88.550.87610.87230.86981.8934sRBM92.7650.91440.91570.92132.7622eRBM94.780.93630.93760.94112.8691Figure10 shows the ROC of eRBM in comparison with other standard classification models. The figure reveals that the true positive rate of the proposed model is better than all the other models showing the better architecture of the proposed model. If this curve is compared with that of training data samples curves for other two datasets, it can be observed that true positive rate of training samples of dataset 3 is lower than the other datasets due to small data samples.Figure 10
ROC of eRBM in comparison with other standard classification models for training of dataset 3.The performance of eRBM with sRBM, KNN, SVM, and decision tree for testing samples of dataset 3 is shown in Table7. As shown in the table, the highest accuracy, precision, recall, specificity, and F1-score have been observed for the proposed model followed by the performance of sRBM for all the evaluation parameters. If this performance is compared with training samples of dataset 3, it is clear that the performance for testing samples is slightly poorer than training data samples.Table 7
Testing samples for dataset 3.
ModelAccuracyPrecisionRecallSpecificityF1-scoreKNN87.540.87410.83420.87552.2316SVM84.540.84540.84340.85551.8765DT85.490.86230.86210.84531.8767sRBM90.980.90020.90320.91122.7234eRBM92.450.91130.92110.92372.8678Bold values highlight the performance of our model, i.e., Restricted Boltzmann Machine.The true positive and false positive rates of all the models are shown in Figure11. As shown in the figure, the highest true positive rate has been observed for the proposed model followed by the standard RBM, whereas there are different fluctuations in the true positive rates of all other models. If this is compared with other two datasets, it can be concluded that the true positive rate of testing data samples for both of them is higher than this testing sample. The reason behind is the smaller dataset which becomes difficult for the models to get trained adequately.Figure 11
True positive and false positive rates of all the models considered in the research study.


### 7.1. Performance Comparison of Different Datasets

In this section, the comparison of the enhanced RBM with standard RBM, KNN, decision tree, and SVM has been presented using different performance evaluation parameters. For all the considered three datasets, the accuracy, precision, specificity, recall, and F1-scores have been shown in Figure11 using different classification models.The training and testing accuracies of eRBM, sRBM, decision tree, SVM, and KNN for the three datasets are shown in Figures12 and 13. In case of training dataset, the proposed model gave highest accuracy of 99.3 for the 2nd dataset followed by the accuracies of 97.9 and 94.78 for dataset 1 and dataset 3, respectively. If keenly observed, all the classifiers gave highest accuracies for the 2nd dataset showing their efficiency in capturing valuable information from the dataset. Similar observations can be found for the testing dataset as well where the eRBM provided 98.56 accuracy for the 2nd dataset followed for 96.66 and 92.45, respectively.Figure 12
Training accuracies of eRBM, sRBM, decision tree, SVM, and KNN for the three datasets.Figure 13
Testing accuracies of eRBM, sRBM, decision tree, SVM, and KNN for the three datasets.Figures14 and 15 show the training and testing specificity of all classifiers for the three datasets. The highest specificity of 0.9895 has been provided by eRBM for dataset 2 followed by dataset 1 and dataset 3 specificity which gave 0.9774 and 0.9491, respectively, for training data samples. Similarly, for testing dataset, the highest specificity has been observed for all the classifiers using dataset 2 followed by dataset 1 and dataset 3, respectively. All the classifiers except the proposed model have different values of specificity for all the datasets. The lowest specificity has been observed for dataset 3 for all the considered classification techniques which shows that there is some problem in capturing the details leading to less efficiency of the model.Figure 14
Training specificity of all classifiers for the three datasets.Figure 15
Testing specificity of all classifiers for the three datasets.The precision of both training and testing data samples for all the classifiers is shown in Figures16 and 17. If the figure is keenly observed, the proposed eRBM model gave higher value of precision than all classifiers for three datasets showing the worth of improvement that has been introduced in the working mechanism of the RBM.Figure 16
Precision of training data samples for all the classifiers.Figure 17
Precision of testing data samples for all the classifiers.As shown in Figures18 and 19, the highest F1-score value is observed for the proposed eRBM in case of both training and testing data samples followed by the sRBM, decision tree, SVM, and KNN, respectively. There can be seen many fluctuations in the performance of other models for both training and testing datasets in terms of F1-score.Figure 18
F measure of the training data samples for all the classifiers.Figure 19
F measure of the testing data samples for all the classifiers.Figures20 and 21 show the performance of eRBM, sRBM, decision tree, SVM, and KNN for both training and testing data samples in terms of recall. The eRBM model gives 0.9989 value of recall for dataset 2 in case training samples followed by dataset 1 and dataset 3 for which the model gave the recall values of 0.9912 and 0.9376, respectively. In the same way, most of the other models gave better results for dataset 2 than the other two considered datasets. Keeping in consideration the values of recall for all the models and datasets, the highest value has been reported by the proposed eRBM models showing the strength of the enhancement introduced in the operational procedure of the RBM. Additionally, some fluctuations can be observed in the values of recall for KNN, SVM, decision tree, and standard RBM in case of all three datasets. There are similar observations in the values of recall for the testing dataset as well.Figure 20
F recall of the training data samples for all the classifiers.Figure 21
F measure of the testing data samples for all the classifiers.Resultantly, considering all the performance evaluation parameters for all classifiers and three datasets, it can be concluded that the proposed eRBM gives better performance than standard RBM, KNN, decision tree, and SVM in case of both training and testing data samples.


## 7.1. Performance Comparison of Different Datasets

In this section, the comparison of the enhanced RBM with standard RBM, KNN, decision tree, and SVM has been presented using different performance evaluation parameters. For all the considered three datasets, the accuracy, precision, specificity, recall, and F1-scores have been shown in Figure11 using different classification models.The training and testing accuracies of eRBM, sRBM, decision tree, SVM, and KNN for the three datasets are shown in Figures12 and 13. In case of training dataset, the proposed model gave highest accuracy of 99.3 for the 2nd dataset followed by the accuracies of 97.9 and 94.78 for dataset 1 and dataset 3, respectively. If keenly observed, all the classifiers gave highest accuracies for the 2nd dataset showing their efficiency in capturing valuable information from the dataset. Similar observations can be found for the testing dataset as well where the eRBM provided 98.56 accuracy for the 2nd dataset followed for 96.66 and 92.45, respectively.Figure 12
Training accuracies of eRBM, sRBM, decision tree, SVM, and KNN for the three datasets.Figure 13
Testing accuracies of eRBM, sRBM, decision tree, SVM, and KNN for the three datasets.Figures14 and 15 show the training and testing specificity of all classifiers for the three datasets. The highest specificity of 0.9895 has been provided by eRBM for dataset 2 followed by dataset 1 and dataset 3 specificity which gave 0.9774 and 0.9491, respectively, for training data samples. Similarly, for testing dataset, the highest specificity has been observed for all the classifiers using dataset 2 followed by dataset 1 and dataset 3, respectively. All the classifiers except the proposed model have different values of specificity for all the datasets. The lowest specificity has been observed for dataset 3 for all the considered classification techniques which shows that there is some problem in capturing the details leading to less efficiency of the model.Figure 14
Training specificity of all classifiers for the three datasets.Figure 15
Testing specificity of all classifiers for the three datasets.The precision of both training and testing data samples for all the classifiers is shown in Figures16 and 17. If the figure is keenly observed, the proposed eRBM model gave higher value of precision than all classifiers for three datasets showing the worth of improvement that has been introduced in the working mechanism of the RBM.Figure 16
Precision of training data samples for all the classifiers.Figure 17
Precision of testing data samples for all the classifiers.As shown in Figures18 and 19, the highest F1-score value is observed for the proposed eRBM in case of both training and testing data samples followed by the sRBM, decision tree, SVM, and KNN, respectively. There can be seen many fluctuations in the performance of other models for both training and testing datasets in terms of F1-score.Figure 18
F measure of the training data samples for all the classifiers.Figure 19
F measure of the testing data samples for all the classifiers.Figures20 and 21 show the performance of eRBM, sRBM, decision tree, SVM, and KNN for both training and testing data samples in terms of recall. The eRBM model gives 0.9989 value of recall for dataset 2 in case training samples followed by dataset 1 and dataset 3 for which the model gave the recall values of 0.9912 and 0.9376, respectively. In the same way, most of the other models gave better results for dataset 2 than the other two considered datasets. Keeping in consideration the values of recall for all the models and datasets, the highest value has been reported by the proposed eRBM models showing the strength of the enhancement introduced in the operational procedure of the RBM. Additionally, some fluctuations can be observed in the values of recall for KNN, SVM, decision tree, and standard RBM in case of all three datasets. There are similar observations in the values of recall for the testing dataset as well.Figure 20
F recall of the training data samples for all the classifiers.Figure 21
F measure of the testing data samples for all the classifiers.Resultantly, considering all the performance evaluation parameters for all classifiers and three datasets, it can be concluded that the proposed eRBM gives better performance than standard RBM, KNN, decision tree, and SVM in case of both training and testing data samples.


## 8. Conclusion

In this paper, enhanced RBM has been formulated to detect pneumonia. There are some drawbacks of the restricted Boltzmann machine which have been eradicated. Although different machines and deep learning techniques have been directed for pneumonia detection, but still, we have to accurate and amplify the accuracy of these techniques. Most correspondents have evaluated normal and abnormal pneumonia whatever it exists or not but could not be differentiated from bacterial and viral pneumonia. We have wiped out these imperfections and upgraded the preciseness of enhanced RBM through the model. Three datasets have been considered in the experimentation for perfectly evaluating the performance of the proposed model. The performance of the model has been evaluated using classification accuracy, specificity, precision, recall, andF1-score for all three datasets and has been compared with standard RBM, decision tree, SVM, and KNN. Although many fluctuations can be seen in the results of all classification models but the highest performance is that of the proposed enhanced RBM showing the strength of the enhancement introduced in the operational procedure of the standard RBM, this developed model can be implemented for using other datasets with other diseases and other similar scenarios which is left as future work of the proposed model.



---

*Source: 1678000-2022-08-12.xml*