A feature-efficient dual-task machine learning framework for predicting bone mineral density and osteoporosis stratification in resource-constrained environments
Plos.org·July 20, 2026
AI Summary
Researchers have developed a machine learning framework designed to predict bone mineral density and identify osteoporosis risk using fewer computational resources, making it applicable in settings with limited infrastructure. The approach addresses the challenge of early osteoporosis detection by employing a dual-task model that can operate efficiently in resource-constrained environments.
Osteoporosis is a chronic skeletal disorder characterized by progressive bone mineral density (BMD) loss and structural deterioration, significantly increasing fracture risk. Despite its high prevalence, early detection remains challenging due to its asymptomatic progression and the limitations of conventional diagnostic techniques, such as Dual-Energy X-ray Absorptiometry (DXA). While DXA remains the clinical benchmark for BMD assessment, its high cost, limited accessibility, and inability to directly detect vertebral fractures necessitate the development of alternative, cost-effective, and widely deployable diagnostic methodologies. A dataset of 159 patient records was collected from NORI and CDA Hospital, incorporating 17 input features spanning demographics, genetic/blood type, clinical history and lab tests parameters. To bridge this gap, we developed a practical machine learning model tailored for clinics with limited resources. Instead of relying on expensive imaging, our framework uses only basic, highly accessible clinical markers—specifically ABO blood groups, serum calcium, and potassium levels. Because these tests are inexpensive and easily processed in standard laboratories, our approach removes the financial and technical hurdles of advanced diagnostics, making early screening possible in remote or underfunded healthcare settings. Data preprocessing involved rigorous feature selection, standardization, hyper-parameters tuning, clinically relevant features derivation and biomarker combinations. For classification, ensemble voting classifier was trained on key biomarkers— Weight, Potassium, Calcium and Total Vitamin D—achieving an accuracy of 90% and an AU-ROC score of 0.93 in predicting osteoporosis severity. In parallel, extreme gradient boosting Regressor trained on Age, Weight, ABO Group and Total Vitamin D demonstrated an R2 of 0.536 for lumbar spine BMD estimation. The proposed framework demonstrates the viability of leveraging machine learning for non-invasive osteoporosis screening and fracture risk assessment, offering a radiation-free and clinically accessible complementary pre-screening tool.
Full story reconstructed from Plos.org. Formatting and media may differ from the original.
Citation: Maryum A, Shaukat A, Yousaf E, Haque A, Yusuf S, Haque Su, et al. (2026) A feature-efficient dual-task machine learning framework for predicting bone mineral density and osteoporosis stratification in resource-constrained environments. PLoS One 21(7): e0354038. https://doi.org/10.1371/journal.pone.0354038
Editor: Gary S. Stein, University of Vermont, UNITED STATES OF AMERICA
Received: April 19, 2026; Accepted: July 2, 2026; Published: July 20, 2026
Data Availability: The full clinical dataset (N = 159) is the property of the Capital Development Authority (CDA) and the Nuclear Medicine, Oncology and Radiotherapy Institute (NORI) and cannot be shared publicly due to patient confidentiality and ethical restrictions. To maintain open-science transparency, a fully de-identified sample dataset (N = 50) preserving all original features (such as Age, BMI, Menopause, Trauma, Smoking, ABO group, and Rh factor) has been provided to verify the machine learning workflows. The minimal data set and accompanying code are available at Zenodo via the following DOI hyperlink: https://doi.org/10.5281/zenodo.20661561 Researchers seeking access to the full dataset for replication purposes may contact the institutional review boards and administrative registries of NORI (nori@noriaech.gov.pk) and Capital Hospital CDA (cdacares@cda.gov.pk).
Funding: The author(s) received no specific funding for this work.
Competing interests: The authors have no conflicts of interest to declare that are relevant to the content of this article.
Osteoporosis is a critical global public health challenge, affecting millions of individuals worldwide, particularly older adults. This systemic skeletal disorder is characterized by a progressive reduction in bone mineral density (BMD) and the deterioration of the microarchitecture of bone tissue, ultimately leading to increased bone fragility and a higher risk of fractures [1]. Among the various osteoporotic fractures, vertebral fractures (VFs) are the most prevalent. However, their clinical detection is often challenging as they frequently occur without noticeable symptoms, earning them the moniker of “silent” fractures [2]. To detect osteoporosis, the gold-standard diagnostic tool, dual-energy X-ray absorptiometry (DXA), is widely used. However, DXA has several limitations, including high costs, limited accessibility, and an inability to directly detect vertebral fractures [3].
With recent advancements in artificial intelligence (AI) and deep learning (DL), medical imaging analysis has undergone a significant transformation, offering promising solutions for improving the detection and management of osteoporosis. In particular, convolutional neural networks (CNNs) have demonstrated remarkable efficiency in identifying abnormalities in medical images [4]. Although much research has been done in the field of osteoporosis detection using AI driven approach, the application of deep learning models to spine radiographs for the direct detection of both osteoporosis and vertebral fractures remains unexplored [5]. Additionally, many existing studies are hindered by small datasets, limited external validation, and an emphasis on BMD estimation rather than direct detection of vertebral fractures, which independently contribute to overall fracture risk [6]. Table 1 shows that serveral studies have explored CNNs for feature extraction and classification. However, challenges such as high computational costs, the need for large annotated datasets, and model interpretability remain areas for improvement.
https://doi.org/10.1371/journal.pone.0354038.t001
Imaging-based models can capture structural patterns well, but these features often need to be complemented by additional information such as clinical features to improve diagnostic reliability as such features significantly influence bone health. Osteoporosis related bone loss is affected majorly with increasing age [2], low BMI [12], gender [13], lifestyle factors such as smoking [14], and sedentary lifestyle habits [15]. Other modifiable factors, including excessive alcohol consumption, poor diet, and insufficient intake of calcium and vitamin D, further exacerbate osteoporosis risk. Deficiencies in these nutrients can trigger secondary hyperparathyroidism, increase bone resorption, and lead to lower BMD levels. Furthermore, individuals with a history of fractures are at an elevated risk of future fractures which underscores the importance of early intervention in high-risk populations [16]. Another critical dimension in osteoporosis assessment involves clinical blood test parameters, such as complete blood count (CBC) data, which offer additional indicators of bone health. Several hematological markers have been linked to osteoporosis, including low hemoglobin levels, which may signify frailty and overall poor health, thereby increasing susceptibility to fractures [6]. Furthermore, elevated inflammatory markers have been associated with increased bone loss, as chronic inflammation plays a pivotal role in osteoclast-mediated bone resorption [17].
Studies utilizing ML models for osteoporosis detection are summarized in Table 2. By leveraging large datasets and advanced machine learning algorithms, predictive models can be developed that combine imaging-derived features with clinical risk factors to offer a more comprehensive evaluation of bone health [16]. Though ML models are effective in osteoporosis classification, they require extensive feature selection and engineering, which can introduce biases and limit model generalizability.
https://doi.org/10.1371/journal.pone.0354038.t002
Several public and private datasets are available for osteoporosis detection and classification. These datasets include medical images, clinical observations, and annotated records presented in Table 3.
https://doi.org/10.1371/journal.pone.0354038.t003
Despite significant progress in AI-based osteoporosis detection, several challenges remain:
Multimodal Data Integration: Combining imaging data with clinical and genetic information can enhance diagnostic accuracy.
Explainability and Interpretability: Developing explainable AI models to increase trust in automated systems.
Severity Classification: Most existing studies focus on binary classification; finer granularity in severity assessment is needed.
Real-Time Deployment: Optimizing models for real-world clinical integration with low-latency inference.
Existing frameworks often rely on high-dimensional clinical data that are not available in primary care or resource-constrained settings. Furthermore, most studies focus exclusively on either classification or regression, missing the opportunity for a multi-stage parallel diagnostic approach. Our study fills this critical gap by proposing a lightweight, cost-effective and dual-stage machine learning framework validated on a self-collected dataset of 159 patients to perform multi-class classification and BMD estimation.
Data for this study were retrieved from the electronic health records (EHRs) of Nuclear Medicine Oncology and Radiotherapy Institute (NORI) and Capital Development Authority (CDA) hospitals, Pakistan. The recruitment period for dataset collection was from 01/07/2024–30/12/2025. Institutional Research Board and Ethical Committee, CDA Islamabad granted full ethical approval for the study protocol which covered the use of de-identified patient data. Informed written consent was obtained from all willing participants. The data were accessed from EHR for analysis after complete acquisition from 05/01/2026–25/02/2026. To maintain patient confidentiality and comply with ethical standards, all data was anonymized before the analysis. All direct patient identifiers, such as names, and medical record numbers, were removed. Each patient was assigned a unique, random identifier to maintain data linkage without compromising confidentiality. This study’s population included a cohort of 187 adults among them 77 were male and 110 were female. Participants were adults aged 18 years and older who had undergone dual energy X-ray absorptiometry (DXA) scan with a T-score recorded for the lumbar spine. Individuals with a prior diagnosis of metabolic bone disease other than osteoporosis were removed from the analysis. A comprehensive data collection protocol is illustrated in Fig 1. Only those records of the patients were included that were complete in all aspects (including DXA scan and all biomarkers data). The final dataset contain the records of 159 patients who underwent X-Ray of lumbar spine for various reasons excluding fractures and bone tumors or history of previous spine trauma. Based on the aim of the study, following 17 variables were included: (a) Demographic data- Age and Gender (b) Anthropometric measurements- Weight, Height and Body Mass Index (BMI) (c) History Information- Smoking, Trauma, Diabetes, Menopause (d) Laboratory tests- ABO-Blood group, Rh factor: positive or negative, Hemoglobin (Hb), Hematocrit (HCT), Alkaline Phosphatase, Serum Potassium, Serum Calcium and Vitamin D levels. Apart from the input biomarkers, we also collected the data of L1 to L4 Lumbar Spine Bone Mineral Density (BMD) value obtained through DXA. Based on the value of BMD, patients were categorized as normal, osteopenic or osteoporotic.
Detailed Workflow of Data Acquisition Protocol.
https://doi.org/10.1371/journal.pone.0354038.g001
Among the 2 target variables, L1 to L4 Lumber Spine BMD has a continuous output value ranging from 0.476 to 1.545 g/cm3. The second response variable was used to determine the severity of osteoporosis. For that three discrete labels were used; 0 for Normal, 1 for osteopenia, and 2 for osteoporosis. The dataset collected was imbalanced being biased towards the normal case having 49.06% of the samples, osteopenia has 34.59% and osteoporosis, the minority class has 16.35% of the total samples.
The numerical raw data were pre-processed and optimal features were filtered and ranked using various machine learning models. A collection of machine learning classifiers and regression models were selected and exhaustively trained separately for each of the input biomarkers combinations. The overall workflow of the proposed methodology is shown in Fig 2. Each of the step performed is explained in detail in below sub-sections.
Detailed Workflow of Proposed Methodology for WHO Spine Classification and BMD Estimation.
https://doi.org/10.1371/journal.pone.0354038.g002
The raw data collected from the hospital were first pre-processed using various steps. First, unnecessary features that don’t contain any useful information for predicting the output variable were identified and removed. Few values for certain biomarkers that were missed during data collection, were filled using class mean. After that, label encoding was applied on the categorical features for transforming the features to their equivalent numerical values for further processing.
The pre-processed data were used as input for feature selection to select the most relevant and optimal features. This process was carried out in two stages.
In Stage-I, Pearson Correlation Coefficient Matrix was used to analyze the relationship between input variables and to check for multicolinearity among them using Eq (1).
where r is the correlation coefficient value within the range −1–1. and x are a single instance value and mean value of the first input variable, respectively, and and y are a single instance value and mean value of the second input variable, respectively. We choose a threshold value of 0.75, as a result the most highly correlated features were removed. The same Correlation Matrix was also visualized using Correlation Heatmap by utilizing python seaborn library.
In Stage-2, the selected features from Stage-1 were further filtered using 5 feature selection techniques including Sequential Forward Floating Selection (SFFS), Linear Support Vector Machine (LSVM), Variance Threshold (with a threshold value of 0.1), Recursive Feature Elimination using Random Forest (RFE-RF) and Logistic Regression (RFE-LR). After that, features were ranked using 2 feature ranking techniques including Extra Trees (ET) and Random Forest (RF) based on their importance. At the end, 10 top most features were selected for further analysis.
For further feature filtering to obtain the optimal features, SHapely Additive ExPlanations (SHAP) analysis was used together with domain knowledge. Fig 3 shows feature importance based on their SHAP values using Extra Trees Classifier and Regressor, and how each feature contributes towards the severity level prediction of osteoporosis and BMD estimation, respectively. Based on the analysis, 8 features were selected as a final feature set () for classification and 9 features were selected as a final feature set () for regression.
SHAP Analysis with beeswarm plot using Extra Trees showing the impact of each biomarker for the final Osteoporosis Severity Level Prediction (Left) and BMD Estimation (Right) in descending order of their importance.
https://doi.org/10.1371/journal.pone.0354038.g003
For classification, data with the final feature set (Xclass) were divided into training and test subsets using Hold-out technique in the ratio of 75:25 for training and testing purpose.
The final feature set obtained was standardized using the StandardScalar provided by python scikit-learn library for the classification task. As the input features had different scales, this preprocessing technique removed bias by scaling all the features to 1 and removing the mean, given by Eq (2).
Where is the normalized input feature vector, is the pre-normalized input feature vector, and and are the mean and standard deviation of the feature vector values, respectively.
For regression, along with standardization, Power Transform was also applied using the Yeo-Johnson method to transform the shape of data just like a Gaussian distribution. The response variable was also transformed. It improves the overall performance of the model by reducing skewness and variance in the data.
Yeo-Johnson transform for the input feature is given by Eq (3).
where is an automatically learned parameter to stabilize the variance, and is the transformed ith feature vector.
As discussed above, the data set was imbalanced, being biased towards normal class with a very small proportion of samples in the osteoporosis class. To handle class imbalance, we used class weights to penalize misclassifications from minority class. Though there are other options available as well to balance the dataset including SMOTE and its variants, ADASYN and GAN based methods, these are distribution-learning methods for oversampling. With a very small size of minority class (only 20 samples for osteoporosis), these methods fail to learn the distribution and generate noisy, duplicate and overlapping samples destroying the class boundaries. So, for our dataset, we used class weights to reduce bias towards the majority class and pay more attention to the minority class, thereby improving recall and hence the overall performance.
To improve the performance of machine learning models, optimal hyper-parameters need to be selected. As the dataset size was limited, Grid Search was used to select the optimal hyper-parameters. A list of manually selected hyper-parameters were exhaustively checked against each classifier and regressor and the best ones were selected that were further used to train various machine learning models.
Finding the severity level of osteoporosis was a multi-class classification problem as there were three discrete output labels. Given this, the selection of meaningful and discriminative features becomes crucial for improving classification performance. So, the most relevant biomarkers (Calcium, Potassium and Vitamin D levels) were used to derive three more features from them including Total Vitamin D to Calcium ratio, Potassium to Calcium ratio and Total vitamin D-Potassium interaction because they represent clinically meaningful relationships related to bone metabolism. Further, 10 different machine learning classifiers were trained using the optimal hyper-parameters already selected. Machine learning models were chosen from linear, non-linear, tree-based and ensemble learning categories and included Logistic Regression (LR), k-Nearest Neighbors (k-NN), Support Vector Machine (SVM), Random Forest (RF), Gradient Boosting (GB), Extreme Gradient Boosting (XGBoost), Categorical Boosting (CatBoost), Adaptive Boosting (AdaBoost), Extra Trees (ET), and Ensemble Voting that used soft voting among the top 3 classifiers. We checked all possible combinations of the selected biomarkers with feature set size ranging from 3 to 8. All the combinations of features were exhaustively trained separately against each of the above-mentioned classifier.
Finding the Lumber Spine BMD value was a regression task as the output label was a continuous value. For regression, 10 different machine learning regression models were trained using the optimal hyper-parameters already selected for this task. Machine learning models were chosen from linear, non-linear, and tree-based learning categories and included RANdom SAmple Consensus (RANSAC), Ridge, Elastic Net, Least Absolute Shrinkage and Selection Operator (LASSO), k-Nearest Neighbors (k-NN), Support Vector Machine (SVM), Extra Trees (ET), Gradient Boosting (GB), Extreme Gradient Boosting (XGB) and Adaptive Boosting (AdaBoost). We checked all possible combinations of the selected biomarkers with feature set size ranging from 3 to 8. All the combinations of features were exhaustively trained separately against each of the above-mentioned regression model.
For classification, five Performance Evaluation Metrics (PEM) were used including Accuracy, F1-score and Area Under Receiver Operating Characteristics Curve (AU-ROC) score measured using Confusion Matrix that details the exact number of true positive (TP), true negative (TN), false positive (FP) and false negative (FN) samples in the form a matrix. For regression, we used three PEMs including Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and R-Squared (R2) values. Their mathematical definitions, operational focus, and ideal target boundaries are consolidated in Table 4.
https://doi.org/10.1371/journal.pone.0354038.t004
The results obtained, based on the exhaustive training and validation, are presented in the form of biomarkers combinations. For classification, the best combination is defined as a subset of biomarkers within the above defined range against which accuracy as well as f1 score is the highest. Similarly, for regression, the best combination is defined as a subset of biomarkers against which R2 is the highest. Table 5 contains the details of each of the biomarker that was collected and analyzed in this study in terms of their category, type, mean and standard deviation values and the class distribution.
https://doi.org/10.1371/journal.pone.0354038.t005
Table 6 shows the top combinations against each of subset ranging from three to eight biomarkers. The corresponding experimentation results of classification are presented in Table 7. Table 8 shows the confusion matrix of the top most combination in terms of highest accuracy and Table 9 presents the results against each regression biomarker combination in terms of RMSE, MAE and R2 value.
https://doi.org/10.1371/journal.pone.0354038.t006
https://doi.org/10.1371/journal.pone.0354038.t007
https://doi.org/10.1371/journal.pone.0354038.t008
https://doi.org/10.1371/journal.pone.0354038.t009
The top 9 features included one Demographic (Age), one anthropometric (Weight (kg)), three clinical (Smoking, Trauma, Diabetes) and three lab tests (Vitamin D level, Serum Potassium and Serum Calcium).
The results presented in Table 7 shows that SC2, SC6, and SC5 produced the best results giving 90%, 90% and 88% accuracy score and 0.93, 0.91 and 0.87 AUC-ROC score, respectively using ensemble voting classifier. Among these three biomarkers Combination, SC2 gave the highest accuracy score containing Weight, Serum Potassium, Total Vitamin D level and Serum Calcium. Results show that these four chosen biomarkers contribute the most towards predicting the severity level of osteoporosis using minimal resources and cost giving an overal accuracy of 90%. Confusion matrix results as given in Table 8 against the best combination show that the ensemble voting classifier was able to correctly classify 95% normal, 93% osteopenia, and 67% of osteoporotic cases.
As clear from the confusion matrix, the model misclassified 1 sample of normal class as osteopenia, 1 sample of osteopenia as normal and 2 samples of osteoporosis as osteopenia. For these 4 misclassified samples, we checked the similarity of the selected input features with the predicted classes, shown in Table 10a using class centroids, shown in Table 10b. Based on Euclidean Distance, we analyzed the distance of misclassified samples with the actual class as well as the predicted class. Table 10c shows that the the distance of misclassified samples to the centroid of predicted class is less as compared to the centroid of actual class. This is because the misclassified samples input feature values resembled those of the predicted class input features. That’s why the model incorrectly labelled them as predicted class. The t-SNE plot of the test samples along with misclassified samples is shown in Fig 4a and class centroids along with the misclassification path is shown in Fig 4b.