Predicting pain with machine learning
AI scientists and doctors partner to understand who is at risk for persistent post-surgical pain

One of the most common surgical complications is postoperative pain that persists long after the surgical incision has healed, striking anywhere between 10% to 35% of the estimated 300 million people worldwide who undergo surgery yearly.
The reason for this persistent post-surgical pain remains unclear. The tangle of risk factors can be difficult to parse. Pain emerges not just from surgical trauma but also a complex combination of interactions between the peripheral and central nervous systems, the immune system and a person’s emotional and cognitive ability to process pain.
That’s where machine learning comes into play. With data collected prior to surgery, machine learning algorithms can tease apart the many factors at play to predict who will likely be burdened with persistent postsurgical pain.
Previous clinical trials to prevent this pain have been unsuccessful when trying to mitigate individual risk factors in a very diverse population of surgical patients.
“Persistent postsurgical pain is so complex,” said Simon Haroutounian, professor of anesthesiology at Washington University School of Medicine in St. Louis. There is no one single formula to determine an individual’s risk, he added.
“It’s not a simple 1 + 1 type of thing, where we collect a few measures and build an accurate risk profile,” Haroutounian said. “This is where we’re really hoping that machine learning can provide an advantage, teasing out some of those smaller contributors to an individual’s risk.”
Haroutounian is part of a multidisciplinary team at WashU researching this problem, including Chenyang Lu, the director of the AI for Health Institute and Fullgraf Professor of Computer Science & Engineering in the McKelvey School of Engineering.
In research published in Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies, Lu and the team share how machine learning can help guide doctors looking to prevent persistent post-operative pain. Most importantly, the system not only predicts who is likely to develop that pain, but also provides uncertainty estimates for each prediction.
Being able to effectively convey the uncertainty can make all the difference in guiding physician decisions. Lu and the team wanted not only the ability to predict patient risk but also include how confident the AI is about that risk estimate, so they developed an “uncertainty-aware” machine learning model.
“It gives the models the ability to say, ‘I don’t know,’ and quantify that uncertainty,” said Ziqi Xu, a PhD student in the Lu lab and first author on the paper.
A common problem in AI-driven clinical decision support systems is that they offer a yes or no answer but no details on how confident the machine is with that answer, Lu said. He compared it to using generative AI programs like ChatGPT: The machine can be “confident” in its answers and response to prompts, even if it’s a hallucination.
However, clinicians need to know the level of uncertainty with predictions so they can use their own knowledge to make the best decision. Humans and the machine learning systems are meant to work as a team and “when you don’t convey uncertainty in a calibrated manner, then it can cause problems,” Lu added.
To provide those estimates, the team enrolled 780 patients to participate in their study. They asked the people to fill out a series of daily survey questions delivered to their smart phones days to weeks prior to surgery. Not every one of the patients took the time to fully fill out the surveys, so missing data was factored into their uncertainty estimates.
Then Lu combined the survey results along with clinical information like a patient’s health history, lab results and more. His team developed a new model that will offer an uncertainty estimate based in part on how much data the patient provided and individual factors in risk assessment.
The model might say: Patient X has a 30% probability of developing persistent pain but there is 50% probability of “uncertainty” in that estimate. In that case, the doctor will need to investigate more and lean into their clinical knowledge to help the patient make the best choice for managing their pain.
In another example, the model may say, patient Y has a 10% probability to develop persistent pain and the model is 80% certain of that estimate. In that case, that doctor can more safely assume the predicted likelihood of persistent pain risk.
In testing their model against other prediction algorithms, the team found it achieves better performance and offers the best model for “calibration performance,” meaning those uncertainty estimates are meaningful and accurate.
From data to the doctor
Incorporating the model into the clinical decision support process is the next step for the research, Lu said.
Doctors want to be able to predict who will develop persistent post-operative pain using data but, importantly, “we also want to understand why,” Lu added. “It’s important to understand the causality and then you can develop interventions.”
Machine learning can help that discovery process to identify the variables most associated with persistent pain, information that can guide better clinical trials.
For some patients, the drivers for risk of post-operative pain are more behavioral, and cognitive behavioral therapy (CBT) interventions could offer solutions.
But other patients could be experiencing pain due to a dysregulated immune response to surgery, and in those cases, CBT approaches might not be sufficient. The focus may need to shift toward interventions that can alter the immune or inflammatory response to surgery, Lu said.
This ongoing work — aimed at refining the model and uncovering the causes of persistent post-operative pain — is supported by a $5 million grant from the National Institutes of Health. As the team continues to test its predictive algorithm, the next step will be to develop personalized interventions based on each patient’s risk profile.
Understanding what contributes to vulnerability or resistance to post-surgical pain — and testing approaches to address these risks — could ultimately make a huge difference in who and how many people are suffering from pain, Haroutounian added.
Ziqi Xu, Jingwen Zhang, Simon Haroutounian, Hanyang Liu, Zihan Cao, Gabrielle Rose Messner, Harutyun B Alaverdyan, Saivee Ahuja, Rahual Koshy, Joel Hanns, Madelyn Frumkin, Thomas L. Rodebaugh, and Chenyang Lu. Incorporating Uncertainty in Predictive Models Using Mobile Sensing and Clinical Data: A Case Study on Persistent Post-Surgical Pain. Proc. ACM Interact. Mob. Wearable Ubiquitous Technol. 9, 2, Article 58 (June 2025) . https://dl.acm.org/doi/10.1145/3729488
This study was supported by a CDMRP grant from the U.S. Department of Defense to Simon Haroutounian, with additional support from the NIH grant 1RM1NS135283-01 to Simon Haroutounian and Chenyang Lu (as well as Meaghan Creed, Pratik Sinha, Thomas Rodebaugh and Andrew Shepherd), as well as support from the Fullgraf Foundation to Chenyang Lu.