# PELM: A Deep Learning Model for Early Detection of Pneumonia in Chest Radiography
## 3 Materials and Methods  
### Data Collection and Preprocessing  
#### 3.1.1 Dataset  
In this study, we formulated pneumonia detection as a binary classification task, distinguishing pneumonia-positive cases from non-pneumonia cases using carefully curated samples from four large-scale, publicly available datasets: NIH ChestX-ray14, CheXpert, PadChest, and Kaggle CXR Pneumonia. For the positive class (label = 1), we included all available posteroanterior (PA) chest X-ray images labeled with pneumonia, irrespective of co-occurring thoracic findings such as pleural effusion, consolidation, or pulmonary edema. This inclusive strategy was designed to capture the clinical heterogeneity typically encountered in real-world diagnostic scenarios. For the negative class (label = 0), we included both normal chest X-rays and those labeled with other non-pneumonic conditions, such as fibrosis, nodules, and cardiomegaly. This deliberate inclusion ensures that the model is trained not only to differentiate pneumonia from healthy lungs but also to distinguish it from other thoracic abnormalities with overlapping visual features--enhancing its clinical robustness. To prevent patient-level data leakage and to support generalization, only a single PA-view image per patient was retained, specifically the earliest available radiograph. This decision mirrors routine clinical workflows, where initial diagnosis is often made based on a single radiographic snapshot. The resulting dataset reflects the diagnostic complexity and class variability seen in contemporary radiology departments, thereby providing a realistic foundation for the development of a clinically reliable and generalizable AI model for pneumonia detection. The class distribution across the contributing datasets is summarized in Table 1.  
NIH Chest X-ray Dataset: The NIH (National Institutes of Health) Chest X-ray Dataset consists of 112,120 chest radiographs from 30,805 unique patients, each annotated with disease labels extracted via Natural Language Processing (NLP) techniques applied to corresponding radiology reports. Although the original reports are not publicly available, the automated labeling process has been estimated to achieve over 90% accuracy, making the dataset particularly suitable for weakly supervised learning tasks [24]. This dataset was first introduced by [PERSON] et al. in their open-access publication \"ChestX-ray8: Hospital-scale Chest X-ray Database and Benchmarks on Weakly-Supervised Classification and Localization of Common Thorax Diseases.\" Despite its strengths, it is important to acknowledge certain limitations--namely, the potential for mislabeling due to NLP-driven annotation and the absence of access to the original radiology reports. Representative samples from the dataset are shown in Figure 1.  
Figure 1: CXR-NIH dataset samples (CXR-NIH) ((**a**) “Infiltration and Pneumonia”, (**b**) “No Finding”, (**c**) “Emphysema and Fibrosis”, (**d**) “Mass”) [24]. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **CXR NIH** & **CheXpert** & **PadChest** & **Kaggle CXR Pneumonia** \\ \hline \multirow{3}{*}{Source} & \multirow{3}{*}{NIH Clinical Center, USA} & Stanford University, Stanford ML Group & San Juan Hospital, Alicante, Spain & Guangzhou Women and Children’s Medical Center, China \\  & & & Group & & \\ \hline \multirow{3}{*}{Images} & 112,120 frontal-view & 224,316 chest & 160,000+ CXR images from 30,805 patients & 160,000+ CXR images from 65,240 patients & 5863 PA-view pediatric chest X-rays (JPEG format) \\ \hline \multirow{3}{*}{Label Method} & 14 thoracic pathologies mined using NLP from radiology reports & 14 observations (e.g., pneumonia, edema) with uncertainty-aware label extraction from reports & 174 radiological findings, 104 anatomical locations, 19 differential diagnoses & physician consensus with third-expert adjudication; bacterial and viral pneumonia classes included \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Data distribution of data sets.