Development of machine learning algorithms for prediction of prolonged opioid prescription after surgery for lumbar disc herniation

Spine J. 2019 Nov;19(11):1764-1771. doi: 10.1016/j.spinee.2019.06.002. Epub 2019 Jun 9.


Background context: Spine surgery has been identified as a risk factor for prolonged postoperative opioid use. Preoperative prediction of opioid use could improve risk stratification, shared decision-making, and patient counseling before surgery.

Purpose: The primary purpose of this study was to develop algorithms for prediction of prolonged opioid prescription after surgery for lumbar disc herniation.

Study design/setting: Retrospective, case-control study at five medical centers.

Patient sample: Chart review was conducted for patients undergoing surgery for lumbar disc herniation between January 1, 2000 and March 1, 2018.

Outcome measures: The primary outcome of interest was sustained opioid prescription after surgery to at least 90 to 180 days postoperatively.

Methods: Five models (elastic-net penalized logistic regression, random forest, stochastic gradient boosting, neural network, and support vector machine) were developed to predict prolonged opioid prescription. Explanations of predictions were provided globally (averaged across all patients) and locally (for individual patients).

Results: Overall, 5,413 patients were identified, with sustained postoperative opioid prescription of 416 (7.7%) at 90 to 180 days after surgery. The elastic-net penalized logistic regression model had the best discrimination (c-statistic 0.81) and good calibration and overall performance; the three most important predictors were: instrumentation, duration of preoperative opioid prescription, and comorbidity of depression. The final models were incorporated into an open access web application able to provide predictions as well as patient-specific explanations of the results generated by the algorithms. The application can be found here: CONCLUSION: Preoperative prediction of prolonged postoperative opioid prescription can help identify candidates for increased surveillance after surgery. Patient-centered explanations of predictions can enhance both shared decision-making and quality of care.

Keywords: Disc herniation; Machine learning; Neurosurgery; Opioid dependence; Orthopaedics; Prediction; Spine surgery.

Publication types

  • Multicenter Study

MeSH terms

  • Adult
  • Analgesics, Opioid / therapeutic use*
  • Case-Control Studies
  • Drug Administration Schedule
  • Female
  • Humans
  • Intervertebral Disc Displacement / surgery*
  • Logistic Models
  • Lumbar Vertebrae / surgery*
  • Machine Learning*
  • Male
  • Middle Aged
  • Orthopedic Procedures / adverse effects*
  • Pain, Postoperative / drug therapy*
  • Retrospective Studies


  • Analgesics, Opioid