Why classification matters. Lung cancer is the leading cause of cancer-related death globally, with a five-year survival rate below 20%. Accurate classification into subtypes -- adenocarcinoma (ADC), squamous cell carcinoma (SCC), and small-cell lung cancer (SCLC) -- directly determines treatment strategy, from surgery to systemic therapies.
Biopsy limitations. Histopathological analysis remains the diagnostic gold standard, but some tumors are anatomically inaccessible and certain patients face serious biopsy risks such as pneumothorax, hemorrhage, and tumor implantation. Additionally, 3-10% of EGFR-mutant NSCLC cases can transform into SCLC, requiring updated classification without repeated invasive procedures.
Current alternatives fall short. Radiomics studies are mostly single-center and lack standardized protocols. Proteomics requires expensive equipment and metabolomics is complicated by dietary and circadian influences. Serological tumor markers exist but no single marker reliably distinguishes between subtypes, creating a clear need for a multi-marker integrated approach.
Study goal. This study developed a machine learning model using only routine clinical and laboratory data -- tests already ordered during standard hospital admission -- to classify lung cancer subtypes without biopsy, and deployed the model as a publicly accessible web calculator.
Retrospective single-center cohort. The primary analysis included 1,122 patients consecutively admitted to Sichuan Provincial Cancer Hospital between November 2023 and June 2024 with confirmed primary lung cancer. A supplemental cohort of 119 patients from a second hospital provided additional external validation.
Data collected. Researchers gathered demographic data (sex, age), tumor staging information, and a comprehensive panel of laboratory tests collected within 24 hours of admission. This included complete blood counts, liver and kidney function tests, coagulation panels, electrolytes, five lung cancer biomarkers (CEA, CYFRA21-1, SCCA, NSE, ProGRP), and additional markers like CA19-9.
Inclusion and exclusion criteria. Only patients with a first-time, histopathologically confirmed primary lung cancer diagnosis were included. Patients with multiple pathological types, other malignancies, missing tumor marker panels, or no routine lab results were excluded. Variables with more than 20% missing data were removed, and random forest imputation handled remaining missingness.
Cohort distribution. The 1,122 patients were distributed as 70.9% ADC, 19.0% SCC, and 10.1% SCLC. The training set contained 787 patients (70%) and the test set contained 335 patients (30%), with stratified random splitting to maintain subtype proportions in both sets.
Dual feature selection approach. Two complementary algorithms selected features from all available variables. LASSO regression penalizes model complexity to retain only the most informative predictors with non-zero coefficients. The Boruta algorithm uses random forests to compare feature importance against randomized shadow variables, retaining only features that consistently outperform chance. Only features identified by both algorithms were used.
Sixteen final features. The intersection of LASSO and Boruta selections yielded 16 features: sex, age, total bilirubin, red blood cells, mean platelet volume, RDW-SD, neutrophils, eosinophils, fibrinogen, magnesium, APTT, CEA, CYFRA21-1, SCCA, NSE, and ProGRP. This combination spans tumor-specific biomarkers and general physiological measurements.
Four algorithms compared. Logistic regression served as the baseline. Three ensemble tree-based models were also trained: XGBoost (gradient boosting), CatBoost (categorical boosting), and Random Forest. All were optimized using five-fold cross-validation within the training set. Tree-based models were chosen because prior research shows they consistently outperform neural networks on tabular clinical data.
Model interpretability. Two metrics explained Random Forest decisions: percent increase in mean squared error (%IncMSE), which measures how much prediction error increases when a feature is randomly shuffled, and increase in node purity (IncNodePurity), which measures how much each variable reduces heterogeneity at decision tree nodes. Higher values on both metrics indicate higher feature importance.
Random Forest dominated training. Among all four models evaluated in the training set, Random Forest achieved the highest performance with an AUC of 0.999, accuracy of 0.984, and an F1 score of 1.000. This substantially outperformed logistic regression, XGBoost, and CatBoost, leading to its selection as the final model.
Feature importance findings. Sex and tumor markers dominated predictive contribution. ProGRP and NSE were the strongest predictors for SCLC classification, SCCA and CYFRA21-1 were most important for SCC, and CEA contributed most for ADC. This biological specificity aligned with the known clinical roles of these biomarkers and validated that the model learned meaningful disease biology rather than statistical noise.
Test set performance. On the held-out 335 patients, the model achieved a micro-averaged AUC of 0.969 and macro-averaged AUC of 0.940. Per-subtype performance varied: SCLC sensitivity 0.857 and specificity 0.993; SCC sensitivity 0.995 and specificity 0.923; ADC sensitivity 0.667 and specificity 0.912. ADC sensitivity was lowest, likely reflecting its biological heterogeneity as the most diverse subtype.
Six-feature streamlined model. A simplified model using only the top six features (sex, CEA, CYFRA21-1, SCCA, NSE, ProGRP) achieved micro- and macro-averaged AUCs of 0.943 and 0.899 in the test set, and 0.878 and 0.856 in the supplemental cohort. This confirms that the core predictive signal resides in the tumor marker panel combined with patient sex.
Deployment via R Shiny. The Random Forest model was converted into a publicly accessible web-based calculator using the R Shiny framework. Clinicians enter values for the 16 predefined parameters and receive real-time probability predictions for each of the three lung cancer subtypes: SCLC, ADC, and SCC.
Output format. The calculator outputs class probabilities rather than a single prediction, allowing clinicians to see not just the most likely subtype but also the confidence levels for each alternative. For example, a sample output showed class probabilities of 0.01 for SCLC, 0.858 for ADC, and 0.132 for SCC, providing nuanced probabilistic guidance.
Resource-appropriate design. The model intentionally uses only routine clinical and laboratory markers that are available in resource-limited settings without specialized equipment. This design choice makes it broadly applicable across diverse healthcare systems, particularly in economically disadvantaged regions where omics technologies are inaccessible.
Potential monitoring application. The model could track changes in tumor subtype classification over time as clinical features and markers evolve, particularly relevant for EGFR-mutant ADC patients who may transform to SCLC during EGFR-TKI resistance, reducing the need for repeated invasive biopsies during treatment.
Comparison to existing methods. The 0.969 micro-averaged AUC achieved by this model compares favorably to logistic regression approaches reporting AUCs around 0.77 and CT radiomics deep learning models reporting AUCs around 0.95. The current model achieves competitive performance without imaging equipment or specialized computational infrastructure.
Class imbalance handling. With 70.9% ADC patients, the model risked bias toward the majority class. Three strategies mitigated this: stratified random splitting preserved subtype proportions in both sets; Random Forest's bootstrap sampling and ensemble voting inherently manage imbalance; and macro-averaged metrics gave equal weight to each subtype regardless of how many samples existed. Strong minority class performance (SCLC sensitivity 0.857, SCC sensitivity 0.995) confirmed that meaningful subtype-specific features were learned.
Integration with liquid biopsy. While the current model uses standard blood markers, circulating tumor DNA and circulating tumor cells represent promising future additions. Incorporating liquid biopsy biomarkers could improve accuracy for ADC, which showed the lowest sensitivity, while maintaining the cost-effectiveness and accessibility of the current platform.
Tumor biology reflected in predictors. The prominence of subtype-specific markers validates known lung cancer biology. NSE and ProGRP reflect the neuroendocrine origin of SCLC. CYFRA21-1 and SCCA reflect keratin expression characteristic of squamous differentiation. CEA elevation in ADC reflects its glandular and mucin-producing phenotype. Machine learning successfully learned these biological relationships from real patient data.
Retrospective and unicentric design. The primary limitation is the single-center retrospective design, which introduces selection bias by only including patients with complete tumor marker panels. Patient demographics, diagnostic practices, and marker testing platforms vary across institutions, limiting how broadly the results apply without further validation.
External validation results. An initial external validation in the supplemental cohort achieved micro- and macro-averaged AUCs of 0.878 and 0.856 respectively, showing meaningful performance generalization. However, the researchers emphasize that comprehensive multicenter validation across diverse institutions and geographies remains essential before widespread clinical adoption.
Untested dynamic monitoring. The model's ability to track lung cancer subtype transformation over time -- particularly EGFR-mutant NSCLC evolving to SCLC during treatment -- has not been prospectively tested. This represents a high-priority research direction because treatment strategies must shift when such transformation occurs.
Actionable conclusions. This study establishes that a Random Forest model trained on routine admission data can classify lung cancer subtypes with clinically meaningful accuracy for patients who cannot undergo biopsy. The web-based deployment creates an immediately accessible tool, with ongoing refinement and broader multicenter validation as the roadmap for clinical integration.