Classification of musculoskeletal pain using machine learning

Machine Learning


To assess the capability of our machine learning architecture, we executed experiments which are detailed in this section. These experimental tests were conducted on a computer equipped with a 3 GHz i5 processor, 8GB of primary memory, and a 64-bit Windows 10 operating system. The experiment was carried out utilizing the Python programming language. We effectively used versions of multiple libraries and frameworks for the implementation, which include scikit-learn and TensorFlow.

Evaluation metrics for classification models

The performance of the trained neural network was comprehensively assessed using standard classification metrics, including accuracy, macro-averaged precision, recall, and F1-score, along with the area under the receiver operating characteristic curve (AUC-ROC). Accuracy quantified the overall proportion of correct predictions, while macro-averaged precision and recall provided class-balanced measures of the model’s positive predictive value and sensitivity, respectively. The F1-score, as their harmonic mean, offered a balanced evaluation of the model’s performance across all classes. Additionally, the AUC-ROC metric evaluated the model’s ability to discriminate between classes by measuring the probability that a randomly chosen positive instance would be ranked higher than a negative one. Together, these metrics ensured a robust assessment of the model’s predictive power, generalization capability, and resilience to class imbalance, providing a holistic view of its classification performance.

These metrics were calculated for both the training and testing sets. Additionally, the confusion matrix and classification report were generated for the testing set to provide a more detailed analysis of the model’s performance. ROC curves were plotted to visualize the trade-off between the true positive rate and the false positive rate. These metrics can be summarized as follows51,52,53:

  1. 1.

    Accuracy: This is the most intuitive performance measure and it is simply a ratio of correctly predicted observations to the total observations. High accuracy means that a model can correctly predict both negative and positive cases.

  2. 2.

    Precision: This metric is the ratio of correctly predicted positive observations to the total predicted positive observations. High precision relates to the low false positive rate. In the context of Pain type classifications, high precision means that when the model predicts a Pain type, it is very likely to be correct, thereby minimizing false alarms.

  3. 3.

    Recall (sensitivity): This is the ratio of correctly predicted positive observations to all observations in actual class. A high recall rate is vital in the context of Pain type classification because as many actual Pain type cases as possible must be correctly identified to ensure timely and appropriate medical intervention.

  4. 4.

    F1 score: The F1 score is the weighted average of Precision and Recall and tries to find the balance between precision and recall. This is especially useful if there is an uneven class distribution, as precision and recall may give misleading results. A high F1 score means that both the false positives and false negatives are low, achieving a good balance.

These metrics are based on a “confusion matrix” that includes true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN)54.

The results of the traditional classification machine learning technique

To evaluate the effectiveness of our machine learning framework, we conducted experiments in this section. The experiments were performed on a computer with a 3 GHz i5 processor, 8GB main memory, and a 64-bit Windows 10 operating system. We used the Python programming language to experiment.

Table 5 presents the performance metrics of various traditional classification models applied to predict different types of musculoskeletal pain. These models were evaluated based on several key metrics, including accuracy, balanced accuracy, ROC AUC, F1 score, precision, recall, and computational time. The goal of this analysis is to identify the most effective traditional models for each pain type, highlighting their classification capabilities and computational efficiency.

Table 5 The performance metrics of traditional classification models.

Analysis of results:

  1. i.

    Neck pain: The ExtraTreesClassifier achieved the highest accuracy (88.5%) and F1 score (0.887), with well-balanced accuracy (0.892) and ROC AUC (0.892). RandomForest and BaggingClassifier also showed strong but slightly lower performance.

  2. ii.

    Shoulder pain: RandomForestClassifier and LGBMClassifier both achieved excellent results (accuracy of 92.7%), with RandomForest slightly leading in terms of precision and recall. ExtraTreesClassifier also performed well with 91.7% accuracy.

  3. iii.

    Elbow pain: Both ExtraTreesClassifier and QuadraticDiscriminantAnalysis achieved the highest accuracy (89.6%), with ExtraTreesClassifier having a slight edge in the F1 score. SVC and CalibratedClassifierCV also performed comparably but with marginally lower scores.

  4. iv.

    Wrist pain: XGBClassifier, ExtraTreeClassifier, and RandomForestClassifier all achieved top-tier accuracy (93.8%), with very close performance metrics, indicating multiple models can effectively handle wrist pain classification.

  5. v.

    Thoracic spine pain: ExtraTreesClassifier led the performance with 88.5% accuracy, followed by SVC and NuSVC, showing that ensemble methods and support vector classifiers are particularly effective for this pain type.

  6. vi.

    Low back pain: ExtraTreesClassifier achieved the best accuracy (93.8%) and balanced accuracy (0.943). RandomForestClassifier also performed strongly (89.6% accuracy), confirming the effectiveness of tree-based models in predicting lower back pain.

  7. vii.

    Hip pain: Both ExtraTreesClassifier and RandomForestClassifier achieved top results (95.8% accuracy), indicating their robustness for hip pain classification. XGBClassifier and BaggingClassifier also showed strong but slightly lower performance.

  8. viii.

    Knee pain: ExtraTreesClassifier and RandomForestClassifier both achieved an accuracy of 90.6%, with ExtraTreesClassifier slightly edging out in balanced accuracy and F1 score. Tree-based ensemble methods dominated here as well.

  9. ix.

    Ankle pain: The ExtraTreesClassifier outperformed other models with the highest accuracy (96.9%), F1 score (0.968), and ROC AUC (0.932). DecisionTreeClassifier, while simpler, also showed good performance (92.7% accuracy), suggesting that decision-tree-based approaches are highly effective for ankle pain classification.

  10. x.

    Tree-based ensemble models (ExtraTreesClassifier, RandomForestClassifier) consistently outperformed other traditional models across most pain types, with high accuracy, balanced accuracy, and F1 scores.

  11. xi.

    XGBClassifier showed strong competitive results, especially for wrist, hip, and ankle pain.

  12. xii.

    Simplicity vs. performance: While simpler models like DecisionTreeClassifier and SVC performed decently, ensemble methods consistently delivered strong and more stable results.

  13. xiii.

    Computational time: ExtraTreesClassifier and RandomForestClassifier required slightly longer times but provided the highest accuracy and reliability, making them a strong trade-off between performance and computation.

The results of the proposed optimized PSO classification technique

Table 6 and Fig. 7 present the performance metrics of the Particle Swarm Optimization (PSO)-based classification model across various pain types. The evaluation criteria include accuracy, precision, recall, F1 score, AUC score, and computational time. This table demonstrates how well the PSO model performs in predicting different musculoskeletal pain conditions, reflecting both its classification strength and computational efficiency.

Table 6 PSO model performance across different pain types.
Fig. 7
figure 7

The performance metrics of the classification models.

Analysis of results:

  1. i.

    Neck pain: The PSO model achieved an impressive accuracy of 96%, with balanced precision (0.959), recall (0.956), and F1 score (0.957), indicating high reliability in classification.

  2. ii.

    Shoulder pain: A similarly strong performance was observed, with 95.8% accuracy and well-balanced precision and recall. The model maintains excellent classification capability while consuming moderate computational time (37.06s).

  3. iii.

    Elbow pain: Remarkably, the PSO model achieved perfect results (100%) across all metrics, demonstrating its exceptional ability to accurately classify elbow pain cases.

  4. iv.

    Wrist pain: The model maintained high accuracy (96.3%), with strong consistency between precision (0.962), recall (0.957), and F1 score (0.959).

  5. v.

    Thoracic spine pain: PSO achieved a near-perfect accuracy of 97.7%, with corresponding high precision and recall values, indicating it can handle more complex pain classifications with ease.

  6. vi.

    Low back pain: The model also performed strongly with an accuracy of 97.2%, reflecting excellent reliability and high classification performance for this common pain type.

  7. vii.

    Hip pain: Another standout result was seen in hip pain classification, with near-perfect performance (accuracy of 99.7%, F1 score of 0.995), showcasing PSO’s exceptional capability in handling this type of pain data.

  8. viii.

    Knee pain: The model delivered robust results with 95.8% accuracy and balanced metrics, maintaining reliable classification accuracy within reasonable computational time (39.39s).

  9. ix.

    Ankle pain: The PSO model achieved 98.9% accuracy, with high precision and recall, and a strong F1 score (0.984), indicating excellent classification power for ankle pain classification.

  10. x.

    Consistently high performance: The PSO model demonstrated consistently high accuracy and F1 scores across all pain types, significantly outperforming traditional classifiers in some areas.

  11. xi.

    Exceptional results for certain pain types: Pain types such as elbow pain and hip pain exhibited near-perfect or perfect classification performance, highlighting the PSO model’s ability to handle more straightforward classification tasks with extreme accuracy.

  12. xii.

    Balance across metrics: Across all pain types, the PSO model maintained a strong balance between precision, recall, and F1 score, ensuring stable and unbiased classification results.

  13. xiii.

    Computation time consideration: While PSO consumed more computational time compared to traditional models (ranging from ~ 36 to ~ 46 s), this is justified by the significantly higher classification performance and optimization efficiency.

Table 6 demonstrates that the PSO-based model provides high performance in classifying musculoskeletal pain types compared to traditional classifiers. It consistently delivers high accuracy, balanced precision and recall, and robust F1 scores, making it a powerful and reliable choice for classification modeling in this domain.

Feature correlations

Feature correlation is employed to discern the intensity and orientation of the linear association between two variables55,56,57. In the realm of regression models, the understanding of feature correlations is multi-purpose:

  1. i.

    Feature selection: The process of dissecting the correlation between elements and the target variable lets us recognize features that manifest the most potent relationships with the target. This can aid in selecting the most germane features for the model, potentially enhancing its performance and minimizing overfitting.

  2. ii.

    Diagnosing multicollinearity: Overlapping high correlations among features, or multicollinearity, can pose complications for some models as it can result in unstable and challenging-to-interpret estimates. Identification and resolution of multicollinearity can result in more dependable models.

  3. iii.

    Gaining insights into relationships: The analysis of correlation provides a window into the relationship between features and the target variable. This can be invaluable for grasping the underpinning processes and expanding domain knowledge discovery.

  4. iv.

    Model simplification: High correlations between two features might allow for the use of only one of them, doing away with any loss of major classification power, simplifying the model, and reducing computation time.

  5. v.

    Enhancing model accuracy: By comprehending the relationships between features, engineered new features can better encapsulate the underlying patterns in the data, potentially enhancing the model’s accuracy.

Comprehensive analysis of correlations across college disciplines and pain experiences

The analysis of the correlations incorporated the college codes (Physical Therapy = 1, Dentistry = 2, Medicine = 3, Pharmacy = 4, Nursing = 5). The analysis is structured into four columns: Correlation Strength, Variables, Category, and Description, and is grouped by meaningful categories for easier interpretation. Additionally, the most important features for each type of pain are highlighted, with a focus on college-specific pain experiences.

Table 7 explores the relationships between age and various factors such as experience, career progression, health, and pain. Age is a significant variable that influences career development, weight, and pain experiences, particularly among individuals in different academic disciplines.

Table 7 Age-related correlations.

Most important features for age-related correlations:

  1. i.

    Experience and career: Age is strongly linked to experience and scientific rank, indicating career progression over time.

  2. ii.

    Weight: Older individuals tend to have higher weight, which may contribute to health issues.

  3. iii.

    Pain: Older individuals report less low back pain, possibly due to better pain management or reduced physical strain.

Exercise and physical activity correlations

Table 8 examines the relationship between exercise frequency, intensity, and pain reduction. Regular physical activity is strongly associated with better health outcomes and reduced pain, particularly in specific body areas such as the knees and hips.

Table 8 Exercise and physical activity correlations.

Most important features for exercise and physical activity:

  1. i.

    Exercise frequency and intensity: Regular exercise is strongly linked to better health outcomes.

  2. ii.

    Pain reduction: More exercise days are associated with reduced knee and hip pain.

  3. iii.

    Physical therapy (code 1): PT students exercise more frequently, which may explain their lower pain levels.

Pain-related correlations

Tables 9, 10, 11, 12, 13 and 14 categorize pain-related correlations by type (e.g., low back pain, hip pain, knee pain) and highlight the most significant variables influencing each pain type. The analysis also explores how pain experiences vary across different academic disciplines.

Most important features for hip pain:

  1. i.

    Recent pain: Hip pain in the last 7 days is a strong predictor of ongoing pain.

  2. ii.

    Activity limitation: Pain that prevents activity is a key indicator of severity.

  3. iii.

    College-specific: Pharmacy students (Code 4) report hip pain due to prolonged standing, but exercise reduces pain.

Most important features for knee pain:

  1. i.

    Recent pain: Knee pain in the last 7 days is a strong predictor of ongoing pain.

  2. ii.

    Activity limitation: Pain that prevents activity is a key indicator of severity.

  3. iii.

    College-specific: Medical students (Code 3) report knee pain due to long working hours.

Most important features for wrist pain:

  1. i.

    Recent pain: Wrist pain in the last 7 days is a strong predictor of ongoing pain.

  2. ii.

    Activity limitation: Pain that prevents activity is a key indicator of severity.

  3. iii.

    College-specific: Dentistry students (Code 2) report wrist pain due to repetitive tasks.

Most important features for neck pain:

  • Recent pain: Neck pain in the last 7 days is a strong predictor of ongoing pain.

  • Activity limitation: Pain that prevents activity is a key indicator of severity.

  • College-specific: PT students report less neck pain, likely due to better ergonomics.

Most important features for thoracic pain

  1. i.

    Recent pain: Thoracic pain in the last 7 days is a strong predictor of ongoing pain.

  2. ii.

    Activity limitation: Pain that prevents activity is a key indicator of severity.

  3. iii.

    College-specific: Nursing students (Code 5) report thoracic pain due to physically demanding tasks.

Table 14 Work and career-related correlations.

Most important features for work and career

  • Workload: College students often balance academic work with part-time jobs, which can contribute to stress and pain.

  • College-specific: Medical students (Code 3) work more days per week but fewer hours per day, which may contribute to stress and pain.

Table 15 summarizes key findings from the study, combining significant weight and health-related correlations with the strongest pain correlations specific to different fields of study. This integrated view helps highlight how both individual health indicators and academic disciplines influence weight patterns and pain experiences.

Table 15 Combined correlations of weight, health, and college-specific pain.

Summary of strong college-specific pain findings.

  1. 1.

    Physical therapy (code 1):

    • Less low back and neck pain: PT students report significantly less low back and neck pain due to better posture, exercise habits, and ergonomic awareness.

  1. 2.

    Dentistry (code 2):

  1. 3.

    Medicine (code 3):

  1. 4.

    Pharmacy (code 4):

  1. 5.

    Nursing (code 5):

Key insights

  1. i.

    Physical therapy (code 1): Demonstrates the benefits of exercise and ergonomic training in reducing pain.

  2. ii.

    Dentistry (code 2): Highlights the need for ergonomic interventions to address repetitive strain injuries.

  3. iii.

    Medicine (code 3): Emphasizes the importance of managing workload and stress to reduce low back pain.

  4. iv.

    Pharmacy (code 4): Suggests the need for breaks and proper footwear to mitigate hip pain from prolonged standing.

  5. v.

    Nursing (code 5): Underscores the importance of proper lifting techniques and physical conditioning to reduce thoracic pain.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *