FormalPara Key Summary Points

Machine learning techniques for classifying patients’ levels of pain are effective.

Machine learning techniques can be used for the classification, manifestation, diagnosis, and management of pain.

Machine learning is increasingly used in pain medicine.


Pain is a complex somatic and emotional phenomenon. Causes of pain are numerous and include traumas, medical diseases, and genetic disorders [1,2,3,4]. The universality of pain as a human experience and the high prevalence of pain underscore the significance of this symptom, while its complexity attracts significant attention from the research community to fully comprehend this experience.

A variety of pharmacological and non-pharmacological approaches have been used for the treatment of pain. Most pain management practices are put in place by medical and nursing staff. This highlights the imperative need to inform this community of professionals on innovative pain relief methods and techniques.

Machine learning (ML) is the use of data and algorithms to imitate the process of human thinking and learning. ML uses a set of methods to automatically detect patterns in big data to gradually inform and improve the algorithm’s accuracy. Then the patterns are used to classify, predict, or extract information from future data from which the algorithm derives new knowledge. In particular, algorithms are trained to produce classifications or predictions, uncovering key insights in data mining projects through the use of statistical methods. Subsequently, these insights influence decision-making impacting key growth metrics. It is worth mentioning that these are accomplished utilizing supervised (i.e., labelled data), semi-supervised (i.e., within a large amount of unlabelled data, a small amount of data are labelled), unsupervised (i.e., unlabelled data), or reinforcement (i.e., develops patterns based on trials and errors) learning, which indicates the ability of the algorithm to independently discover, adapt, and respond to unscripted patterns and groups of data [5,6,7]. On the basis of the nature of the data, different techniques are used in ML analysis. The most common techniques are classification for supervised data (e.g., predict and categorize specific data, like the type of pain) or regression for semi-supervised and unsupervised data (e.g., predict a reaction that can cause pain, without having a prior knowledge of that reaction). The most common ML algorithms discussed in this review are presented in Table 1.

Table 1 Machine learning algorithms that have been used in pain medicine to date

With this systematic review, we are mostly interested in exploring the clinical uses of ML related to pain. For the purpose of this review, the following specific research questions were addressed:

  1. 1.

    Is ML an effective solution for classifying, predicting manifestation, and managing pain?

  2. 2.

    What are the ML techniques mostly used in pain medicine?

  3. 3.

    What are the future directions of ML?


Protocol Registration

This review was registered in PROSPERO (registration number CRD42021248001), an international database of prospectively registered systematic reviews in the context of health and social care.

Compliance with Ethics Guidelines

This article is based on previously conducted research and does not contain any studies with human participants performed by any of the authors. Therefore, ethical approval was not required.

Literature Review Strategy

A systematic literature search of the PubMed database was performed on 15 July 2021 using three Medical Subject Heading (MeSH) terms that had to be present in the title. Term A was “Machine Learning” OR “Support Vector Machines” OR “Neural Networks” OR “Deep Learning” OR “Multi-Layer Perceptrons” and term B was “Pain” OR “Painful”. No filter was applied. The reference lists of articles that met the eligibility criteria were further perused to identify additional studies that may fall within the scope of this review.

Inclusion and Exclusion Criteria

Studies eligible to be included in this review had to meet the following inclusion criteria: (1) human subjects were involved; (2) the full article was written in English; (3) papers studied ML in pain medicine.

The exclusion criteria were (1) publications where the study of pain was not the primary aim of the study; (2) publications that were not original studies (i.e., review articles, letters, medical hypotheses, etc.); (3) publications where ML method was not used for pain assessment; (4) publications presented trials with fewer than ten patients per treatment arm; (5) publications presented trials studying subjects less than 18 years old; (6) duplicate publications or studies referring to the exact same population; (7) publications whose abstract was not accessible; (8) publications whose full text could not be obtained.

Data Collection Process

Following identification of the eligible publications, all relevant data were collected in a structured coding scheme using an Excel file. On the basis of the aim of each study, included papers publications that used ML for pain were grouped into the following categories: (1) pain classification; (2) pain diagnosis; (3) prediction of pain manifestation; (4) pain management. The data collected included demographics, the type of pain, the ML technique, the input data size, the instruments, the results, and the level of accuracy in each ML approach. When there was uncertainty regarding how the data should be interpreted or utilized, a cross reliability test between three authors was performed.

Data Synthesis

This study used aggregated data where possible, in accordance with the Preferred Reporting Items for Systematic Reviews and Meta-Analysis (PRISMA) guidelines [8].


Search Results

This search strategy resulted in the identification of 100 articles. After the eligibility assessment, 78 articles were excluded. A further four articles were identified through manually perusing the reference lists of the included articles. In total, 26 papers met the inclusion criteria and were used for this review [9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]. These studies were published between 2015 and 2021. Figure 1 (PRISMA chart) illustrates the study selection process.

Fig. 1
figure 1

PRISMA chart

Effectiveness of ML in Pain Classification, Diagnosis, Manifestation, and Management

Table 2 presents the characteristics of the studies, including the ML method that was applied and the respective results.

Table 2 Summary characteristics of pain studies included in this review

ML techniques for classifying the intensity of pain were found to be effective in patients with low back pain (LBP) [9, 12, 13, 16], osteoarthritis [21], ankylosing spondylitis [30], spinal cord injury [26], thoracic pain[29], sickle cell disease (SCD) [32], evoked heat pain [25, 27], and other types of pain [15]. In their case-controlled study, Abdollahi et al. classified pain based on quantitative kinematic data. In their case-controlled study, Liew et al. collected electromyographic and kinematic data which were used to classify pain [13]. Brain functional imaging and autonomic activity (i.e., heart rate variability) data were collected by Lee et al. after back pain exacerbation maneuvers to measure pain intensity with the aid of support vector machine (SVM) [12]. In their case controlled study, Santana et al. used functional magnetic resonance imaging (fMRI) data in 60 patients with chronic pain (36 subjects with fibromyalgia and 24 subjects with low back pain) and 98 pain-free controls in order to compare the performance of different ML models in pain classification and found that CNN, which assessed data using the MSDL probabilistic atlas, was the most efficient with balanced accuracy ranging from 69% to 86% [16]. In two studies, EEG data have been used for pain classification in patients with osteoarthritis [21] and in patients with pain due to spinal cord injury [26]. Overall, the results of these studies suggested that supervised ML algorithms can accurately classify the intensity of pain regardless of its type. For more accurate results, it was suggested to compare patients’ responses with responses collected by healthy individuals [26]. In a case series study, Rojas-Mendizabal et al. performed an analysis of 27 variables, which included demographic and clinical parameters, in order to evaluate the origin of thoracic pain and determine a possible correlation between these parameters and the presence of cardiac pain, managing to obtain a mean accuracy of 96% [29]. Rogachov et al. acquired resting-state functional MRI and quantified frequency-specific regional low-frequency oscillations (LFOs) in patients with chronic pain and ankylosing spondylitis and, using an ML approach, found that higher frequencies can be used to make generalizable inferences about patients’ average pain ratings (trait-like pain) but not current (i.e., state-like) pain levels [30]. These results were also validated with healthy individuals, revealing higher brain signal variability in the dynamic pain connectome [30]. Pouromran et al. evaluated electrophysiological data of evoked heat pain from healthy subjects via different ML methods in order to predict the pain intensity and found that electrodermal activity using a support vector regression (SVR) model gave the best performance with an accuracy of 83% [27]. In their study, Gruss et al. using biopotential data and an SVR model estimated the evoked heat pain intensity and characterized the pain patterns with an accuracy of over 90% [25]. Yang et al. used physiological measurements for 40 patients with SCD to predict their pain intensity by applying different ML methods [32]. Multinomial logistic regression (MLR) illustrated the best performance on pain prediction with a mean accuracy of 0.578 at the intra-individual level and a mean accuracy of 0.429 at the inter-individual level. Finally, a study suggested that to increase the positive outcomes of ML on pain, the predictive models of pain should consider other variables like sleep patterns which can be associated with the experience of pain, offering an accuracy of 81% [14].

Grauhan et al. used CNN for the effective diagnosis of the cause of shoulder pain on 2700 plain radiographs (X-rays) with the best accuracy to be for osteoarthritis (87%), even when presented with poor image quality [30]. Santra et al. used Bayesian networks to resolve diagnostic conflicts for the cause of LBP [17].

Prediction of manifestation of pain was also one of the commonest reasons for performing ML analysis. In a case control study, Darvishi et al. compared the neural network model approach with the logistic regression model approach in 92 workers with LBP and 68 healthy workers and showed that the former can predict more effectively the development of LBP [10]. Goldstein et al. built a mobile platform to predict patients’ pain levels after a period of 2 weeks based on self-reported pain ratings and emotional state and found that a previous history of pain and fatigue are good predictors of pain [33]. In an open-label trial, Snyder et al. used a deep CNN model with which they used gyroscope and accelerometer data and classified the relative risk that lifting activities have for the development of back pain and injury, achieving an accuracy of 91% compared to an alternative CNN and multilayer perceptron (MLP) [18]. ML techniques were found to be effective in predicting even in real-time pain occurrence in a large cohort of postoperative patients, using numerous clinical variables retrieved through surgical records [24], which accurately helped the clinicians to provide the patient with appropriate pharmacological analgesics [24, 31]. This was done via self-reported data such as pain intensity scales, emotional responses, quality of life, and an indication of the pain areas. Fernades et al., using a Bayesian modelling approach, developed a risk prediction model based on clinical parameters for the development of knee pain, regardless of underlying structural changes of knee osteoarthritis, which appeared to work well in a community-based population [20]. Lötsch et al. analyzed demographic, patient-rated, and objective clinical factors and using ML identified early parameters that provided information about a future development of persistent pain in rheumatoid arthritis [22]. Juwara et al. identified baseline clinical data as predictive factors for neuropathic pain after breast cancer surgery using machine learning [28]. Finally, one study focused on measuring and predicting pain volatility, which was defined as the mean of absolute changes between two consecutive self-reported pain severity scores recorded via a mobile application [15].

Lastly, it was also demonstrated that ML for pain management has also been a key sector since it is empowering the reduction of negative body sensations and pain. Parthipan et al. studied the treatment of pain via prediction and prescription of the required opioid dose for managing pain due to osteoarthritis or post-surgery [23]. In their study, Ahn et al. used ML to demonstrate the effect of transcranial direct current stimulation (tDCS) in the management of pain [19]. In their study, Wang et al. developed and tested ML models to predict which patients with lung cancer and pain due to bone metastases should receive local treatment and found that a decision tree (DT) model was the most effective and accurate method for that aim [34].

ML Techniques

In the studies evaluated, a wide variety of ML algorithms were used. Most of these algorithms were supervised classification or regression techniques to address issues related to pain. The selected studies used mostly classical ML algorithms, such as SVM [9, 12, 15, 21, 22, 25,26,27], and random forest (RF) [14, 15, 28, 29, 31, 32] followed by Bayes [17, 19, 20, 22] techniques to classify tasks by assigning a predefined class label to an observation.

Numerous types of regression ML algorithms were also used by the reviewed studies [10, 15, 23, 27, 28, 30, 32]. This type of ML algorithm outputs continuous numerical values, rather than assigning a predefined class label to a data pattern.

Most of the reviewed studies used this ML technique to classify the patient’s intensity of pain [9, 12, 14, 15, 21, 22, 28]. On the other hand, most of the reviewed studies which used the regression ML algorithms mostly predicted pain occurrence, probability, volatility, and management response, via a continuous set of data [10, 15, 23, 27, 28, 30, 32].

The best performing ML algorithms were a boosting (i.e., FDboost), a regression (i.e., Elastic Net), and a neural network (NN), all three of which achieved a classification accuracy of more than 90% [10, 13, 23]. The worst performing ML algorithm was a k-nearest neighbors (kNN), which achieved a 52% accuracy [32]. Table 3 presents the data sources and size along with the ML methods and their accuracy.

Table 3 Data sources and size, ML methods, and percentage accuracy


More than half of the studies included in this review were published since 2020, which indicated that the use of ML for pain has increased over time. ML has been shown to be successful in learning how to map complex features to a known class.

The large number of papers in this literature review shows that the use of ML in research on pain has been of great importance and is considered to be highly beneficial for classifying, predicting, diagnosing, and managing pain This is because the amount of health-related data is rapidly expanding and large amounts of data are stored in clinical systems (i.e., a result of the advances in health technologies deployed in the medical sector) and personal consumer health devices such as mobile applications and wearables.

To improve the management and treatment of pain it is essential to be able to identify personalized healthcare treatment patterns. ML is considered to be beneficial because it succeeds at recognizing and predicting patterns, links, and relationships throughout big and complex datasets, independently of human supervision. As a result, ML was found to predict, classify, and suggest potential treatments of pain.

This review revealed that a wide variety of ML techniques have been employed in pain medicine. Most of these methods involve supervised classification or regression algorithms and contributed to the management of pain.

Our results should be interpreted with some caution given the limitations of our design. First, there was a great deal of heterogeneity between the studies, involving different interventions and different populations. Second, we only searched for publications in PubMed—albeit the largest medical database—and we therefore might have missed a few more papers that are indexed only in other databases.


Our review highlights the need for further use on ML in pain research in order to develop more algorithms that will be able to accurately predict and assist medical personnel in efficient diagnosis, successful decision-making, and effective treatment of pain. Furthermore, it is expected that explainable artificial intelligence systems will be developed to support decision-making [35] so that the medical personnel can better handle pain management.