Neural Networks to Predict Long-term Bariatric Surgery Outcomes

| December 1, 2017

by Diana M. Thomas, PhD; patrick Kuiper, MS; Hinali Zaveri, MD; Amit Surve, MD; and Daniel R. Cottam, MD

Diana M. Thomas, PhD, and Patrick Kuiper, MS, are with the Department of Mathematical Sciences, United States Military Academy in West Point, New York. Hinali Zaveri, MD; Amit Surve, MD; and Daniel R. Cottam, MD, are with the Bariatric Medicine Institute in Salt Lake City, Utah.

Funding: No funding was provided.

Disclosures: The authors report no conflicts of interest relevant to the content of this article.

Abstract:The objective was to predict longer term weight loss success from pre-operative and short-term surgery data using machine learning. Eight neural networks that predict long-term weight status one year after surgery were trained and tested. Four neural networks classified weight loss success and continuous outcomes from solely pre-operative routinely collected clinical variables. The remaining neural networks predicted long-term outcomes from a combination of pre-operative variables and weight-related short-term data obtained in less than one month post-surgery. Patients (N=478) underwent eight different surgeries (including revisional surgeries) at a single private practice institution between January 2010 and April 2014. Demographic data and comorbid conditions data were gathered retrospectively on a prospectively kept database. Neural networks that classified weight loss success yielded an area under the curve of 0.77 to 0.78 pre-operatively, which improved to 0.82 with inclusion of short-term data. The continuous long-term weight was also well predicted with R2 values in three of the four networks ranging from 0.68 to 0.72. These results improve on previously obtained predictions that relied on linear regression. Machine learning algorithms like neural networks might provide a feasible and scalable method to amplify long-term predictive accuracy from pre-operative and short-term observations to inform

Keywords: Artificial neural networks, pre-operative predictors, post-operative predictors, mathematical modeling

Bariatric Times. 2017;14(12):14–17.


Long-term, sustained, high-quality outcomes resulting from bariatric surgery are well documented.1–5 On average, patients undergoing bariatric surgery observe substantial weight loss and remission of or improvements in obesity-related comorbidities, such as type 2 diabetes mellitus (T2DM), dyslipidemia, hyperlipidemia, and hypertension.2,6–10 Despite good results in the mean, there is still high variability in outcomes.2 Specifically, the Longitudinal Assessment of Bariatric Surgery (LABS) study11 found that one quarter of the Roux-en-Y gastric bypass (RYGB) patients lost less than 25 percent of their body weight and one quarter lost more than 38 percent of their body weight. Similar variability was reported for laparoscopic adjustable gastric band (LAGB) patients. In fact, this variability is well documented by the surgical literature, which quantifies intervention “failures” in terms of percentage of study participants who did not observe adequate weight loss or remission of pre-existing morbidities.12–14 In addition to variability of long-term outcomes, different surgeries own different levels of risk15–21 and yield substantial differences in mean percent weight loss.15,22–25 With the great wealth of existing available bariatric surgery data, it is attractive to personalize predictions that identify which surgery is optimal for a patient based on balancing risks against long-term success.

There have been a number of attempts to develop predictive models by establishing pre-operative predictors of long-term success within each surgical procedure.24,26–31 Known variables include pre-operative age, body mass index (BMI), sex, waist circumference, hemoglobin A1c (HbA1c) levels, and psychosocial characteristics. Unfortunately, to date, standard regression has not yielded strong pre-operative predictions. Of particular note was that the LABS study, which included over 100 pre-operative carefully measured variables, did not find strong pre-operative predictors of three-year weight loss (R2=0.14). However, the inclusion of genetic factors to predictively model long-term percent weight loss was promising.32 The inclusion in a regression model of a single nucleotide polymorphisms (SNP) associated to percent weight loss after RYGB surgery to clinical factors (age, sex, pre-operative BMI, and T2DM status) yielded an area under the curve (AUC) of 0.633. The regression model developed with clinical factors alone generated an AUC of 0.620.

Recently, neural network algorithms have been successfully applied to genetic information obtained from bariatric surgery to rank the importance of clinical and genomic factors involved in diabetes remission after bariatric surgery.33 With only pre-operative variables combined with HbA1c and insulin levels, the investigators achieved an AUC of 0.81. Adding genomic information improved the AUC 0.92.

In real-world clinical settings, the simplest pre-operative measures remain baseline anthropometrics, demographic information, and comorbidity status. Here, we rely on clinical data to develop and test a neural network algorithm to answer the following questions:

  1. How well can we pre-operatively predict long-term weight loss success from routinely collected clinical measures?
  2. How much do the predictions improve if we include short-term weight loss information (<1 month)?
  3. What are the most important variables that contribute to long-term outcomes?


Neural networks are machine learning self-adaptive models that can adjust themselves to the high volumes of input data without specification of functional or distributional form providing a particularly well-suited methodology for integrating and combining data obtained from different surgeries and surgeons. In addition, a sensitivity analysis arising from network development computes importance of each predictor or rank ordering.33


Patients. Patients (N=478) underwent eight different surgeries (including revisional surgeries) at a single private practice institution between January 2010 and April 2014. Demographic data and comorbid conditions, which included T2DM, hypertension (HTN), sleep apnea (SA), and gastroesophageal reflux disease (GERD), were collected in six of the eight surgeries. Comorbidities were only recorded if the patient was taking medication or was formally diagnosed with sleep apnea. Data was gathered retrospectively on a prospectively kept database. The retrospective data collection was reviewed and approved by the commercial Institutional Review Board, Quorum Review IRB.

From this master database, we retained data, which included a measured body weight obtained at the first long-term clinical visit past one year. Hereafter, we define any long-term measurement as those obtained at the first clinical visit after one year post surgery. Subject characteristics of this reference database appear in Table 1.

Description of surgeries performed. Subject numbers in the eight surgeries performed appear in Table 1. Loop duodenal switch, or laparoscopic single anastomosis duodenal switch, uses the laparoscopic vertical sleeve gastrectomy as the first step of the surgery but does not divide the distal intestine, instead bringing up a loop of intestine to connect it below the pylorus.

Regular duodenal switch, or laparoscopic Roux-en-Y duodenal switch, uses the laparoscopic vertical sleeve gastrectomy as the first step of the surgery and then divides the intestine and reconnects it below the pylorus.

Sleeve or laparoscopic vertical sleeve gastrectomy provides volume reduction of the stomach by removing a great portion of the stomach using staples.

Gastric bypass, or laparoscopic RYGB, partitions the stomach into two halves. Then the intestines are reconnected to the upper half while bypassing the lower half. In order to do this, the intestines are also divided, with one half going up and the other half being reconnected further down. This restricts the amount a patient can eat and reduces fat intake through malabsorption.

Gastric bypass to duodenal switch included any gastric bypass surgery that failed and was revised by a second surgery.

Band to duodenal switch included any band surgery that failed and was revised by a second surgery.

“Bandication,” or laparoscopic adjustable gastric banding with gastric plication, represents a technique combining the volume reduction of the plication with the restriction of the band to enhance the weight loss

Band or laparoscopic adjustable gastric banding relies on an implanted silicone band around the upper stomach to constrict the amount of food a patient eats.

Neural networks. Overview of neural networks. A neural network is a mathematical representation of the human brain and falls under the category of artificial intelligence. Neural networks have the capacity to “learn” like the human brain. The neural network is modeled as a series of neurons, which are organized in layers. Each neuron in one layer is connected to neurons by values called weights. The weight values describe the direction and strength of the connection between neurons. An input neuron represents information that is presented to the neural network. It is similar to our brains receiving information from our senses. An output neuron represents a prediction made after synthesis within the neural network. This is similar to how our brain makes a conclusion after receiving information from our senses.

Neural network development. Neural networks first train, or learn by fitting the values of the weight after being fed input data. Once the data has been used to train the neural network, the neural network is presented with new data that was not used to train the network with and the predictions of the neural network are compared to the actual data in the new data set. The quality of the neural network is evaluated by its performance on the training data set.

Eight neural networks were trained and tested using the statistical package SPSS v21 (IBM Corp, Armonk, New York). The training set and testing set data were randomly selected by the statistical package to approximately reflect 70 percent of the data for training the neural network and 30 percent of the data for testing.

Neural networks can predict binary outcomes, such as success versus failure. Success needs to be defined beforehand, for example, “exceeding a threshold percent weight lost.” The coarsening of outcome as a classification improves predictive accuracy, and combined with the amplification yielded by a neural network versus standard regression should result in an increase of accuracy previously reported. On the other hand, neural networks can also predict a continuous variable like weight at the first clinical weigh in one-year post surgery. Four neural networks were trained to predict long-term weight, day of long-term clinical weigh-in, weight loss, and percent weight loss.

In the neural networks where predictions were classified as success versus non-success, receiver operating characteristic curves were generated, and the AUC was computed. Values of AUC closer to 1 indicate improved performance of the neural network as a diagnostic tool that classifies long-term success. The percent correctly classified in both the training and testing set were also calculated. For neural networks predicting continuous variables of long-term weight, day of long-term clinical weigh in, weight loss, and percent weight loss, the Pearson Correlation Constant was calculated for the actual versus predicted on the test data set. The mean relative percent error was computed for both the training and testing datasets. Relative error is calculated as the ratio of continuous outcomes that were inaccurately predicted over total predictions. Percent error is the relative error multiplied by 100.   Lower values of percent error represent more accurate predictions. All neural network outputs included a rank ordering of input variable importance contributing to the predictions.

Neural networks that classify long-term weight loss success. The first neural network relied on solely pre-operative inputs of surgery types 1 to 8, age, height, weight, BMI, and sex. A binary output of whether the patient lost more than 35 percent of their body weight after one year or not was predicted using 71.8 percent of the data. The model was independently tested on 28.2 percent of the data, which was not used for model development.

The second neural network again relied solely on pre-operative measurements, but additionally included comorbidities. Because the last two surgeries did not retain data on patient comorbidities, only data from surgery types 1 to 6 were applied. Similar to the first model, a binary output of whether the patient lost more than 35 percent of their body weight after one year or not was predicted using 63.4 percent of the data. The model was independently tested on the remaining portion of the data not applied for model development.

The third neural network used pre-operative inputs of surgery types 1 to 8, age, height, weight, BMI, and sex, combined with data that identifying whether the patient came in for a clinical visit within one month (<31 days). If the patient did come in before 31 days, then input data of short-term weight loss and percent weight loss were also included as inputs. A binary output of whether the patient lost more than 35 percent of their body weight after one year or not was predicted using 68.6 percent of the data and independently tested on the remaining data.

Finally, a fourth neural network applied inputs of pre-operative measurements, comorbidities, and short-term visit information as in the third model. A binary output of whether the patient lost more than 35 percent of their body weight after one year or not was predicted using 63.4 percent of the data and independently tested on the remaining data.

Neural networks that predict long-term percent weight loss. Four additional neural network models were trained to predict weight (kg) after one-year, weight loss (kg), day of long-term weight loss visit, and percent weight loss as continuous variables using the same input neurons as in neural networks one through four, described above. Description of input and output neurons for each of the eight neural networks appear in Table 2.



The summary of neural network quality and rank order of predictor variable importance appears in Table 3.

Neural network classifiers of long-term success. Classification of weight loss success using only pre-operative markers and no information on comorbidities yielded AUCs of 0.77 and 0.78 with pre-operative information only. This means that with only pre-operative demographic, anthropometric, and comorbidity information alone, the neural networks can correctly identify which patients will result in successful weight loss over a year from surgery with 78 percent accuracy. If whether patients attended a clinical visit within the first month after surgery and if available weight loss information is included, the AUC improves to 0.82.

Neural network prediction of long-term weight. The best predicted long-term output neuron was long-term weight. The Pearson Correlation Constant ranged between 0.68 to 0.72 with one exception for the case where all pre-operative and short-term inputs were considered. In this case, the R2 lowered to 0.47.


Using a carefully documented clinical database of patients undergoing eight different surgeries, we demonstrate that application of a neural network substantially improves the capacity to predict long-term success and weight loss from pre-operative variables that are routinely obtained in clinical settings with classification of success at close to 80 percent accuracy, with 70 percent of the variance explained by the neural network. Including variables obtained in less than one month adds to the accuracy of predictions. Because surgery type was ranked high in importance, these results suggest that pairing patients pre-operatively with optimal type of surgery can improve long-term outcomes.

To date, pre-operatively predicting long-term success in bariatric surgery patients using standard regression has remained elusive.34 Despite knowledge of pre-operative variables that contribute to long-term success, only a small percentage of the variance (R2=0.14) can be explained by these covariates. Machine-learning algorithms, like the one presented here, are designed to amplify predictions, and our analysis strongly supports this conclusion.

The study’s strengths involve application of real clinical data collected over a period of several years with surgeries performed by several surgeons. The results using this database bring confidence to the idea that models can inform surgical decisions in clinical practices.

While our study provides preliminary evidence of improved predictions, it has several limitations. The strength of applying real clinical data also represents limitations. Unlike federally funded clinical studies, which are carefully pre-planned and designed to retain subjects and obtain measurements at specified times,34 data housed in a clinical setting can be complex and unrefined. For example, a sizable number of patients do not return for a follow-up visit. Moreover, even if a patient attends a follow-up visit, they might not return in the first month or post-one year after surgery. Patients might come in for a follow up for the first time at 200 days and never return. The problem of nonadherence to follow up or persistence is well-known35 and contributes to the challenge of developing informative models. These and other difficulties can provide unique challenges in cleaning databases and preparing them for model development. In fact, the deviation of one neural network’s capacity to predict, despite our efforts to maintain database integrity, might arise from continuously revising and pairing data input and output variables.

Another limitation involved size and scope of the database. Data was collected at one clinic in Utah, and despite long-term collection, more data in each surgery type stands to improve neural networks trained for application over diverse populations and surgeries. Additionally, more clinical measures, such as the presence of diabetes and even pre-diabetes measured through hemoglobin A1c, might improve predictions. Unfortunately, most models to date rely on single or a couple types of surgeries,34,36,37 and it is rare for a study to consider several options at once. It is also rare to track many different clinical measurements as done in the research based funded LABS study.34 As data are shared and combined over time,38 models can rely on larger and broader databases for model development.

Finally, moving away from simpler regression models also can impede application to clinical practice. As models improve, user-friendly apps should be designed to deliver model predictions to surgeons and patients quickly, effectively, and efficiently.


Neural networks and other sophisticated machine-learning algorithms can amplify long-term predictive accuracy from pre-operative and short-term observations beyond standard methods like regression. These models can provide personalized information to guide patient-surgeon decisions.


  1. Adams TD, Davidson LE, Litwin SE, et al. Health benefits of gastric bypass surgery after 6 years. JAMA. 2012;308(11):1122–1131.
  2. Courcoulas AP, Christian NJ, Belle SH, et al. Weight change and health outcomes at 3 years after bariatric surgery among individuals with severe obesity. JAMA. 2013;310(22):2416–2425.
  3. Sjoholm K, Pajunen P, Jacobson P, et al. Incidence and remission of type 2 diabetes in relation to degree of obesity at baseline and 2 year weight change: the Swedish Obese Subjects (SOS) study. Diabetologia. 2015;58(7):1448–1453.
  4. Sjostrom L, Peltonen M, Jacobson P, et al. Association of bariatric surgery with long-term remission of type 2 diabetes and with microvascular and macrovascular complications. JAMA. 2014;311(22):2297–2304.
  5. Hatoum IJ, Blackstone R, Hunter TD, et al. Clinical factors associated with remission of obesity-related comorbidities after bariatric surgery. JAMA Surg. 2015:1–8.
  6. Dicker D, Yahalom R, Comaneshter DS, et al. Long-term outcomes of three types of bariatric surgery on obesity and type 2 diabetes control and remission. Obes Surg. 2016;26(8):1814–1820.
  7. Burza MA, Romeo S, Kotronen A, et al. Long-term effect of bariatric surgery on liver enzymes in the Swedish Obese Subjects (SOS) study. PLoS One. 2013;8(3):e60495. Epub 2013 Mar 26.
  8. Sjostrom L. Review of the key results from the Swedish Obese Subjects (SOS) trial—a prospective controlled intervention study of bariatric surgery. J Intern Med. 2013;273(3):219–234.
  9. Sjostrom L, Peltonen M, Jacobson P, et al. Bariatric surgery and long-term cardiovascular events. JAMA. 2012;307(1):56–65.
  10. Sjostrom L. Bariatric surgery and reduction in morbidity and mortality: experiences from the SOS study. Int J Obes (Lond). 2008;32 Suppl 7:S93–S97.
  11. Belle S, Consortium L. The NIDDK Bariatric Surgery clinical Research Consortium (LABS). Surg Obes Relat Dis. 2005;1(2):145–147.
  12. Moon RC, Teixeira AF, Jawad MA. Treatment of weight regain following Roux-en-Y gastric bypass: revision of pouch, creation of new gastrojejunostomy and placement of proximal pericardial patch ring. Obes Surg. 2014;24(6):829–834.
  13. Nicoletti CF, de Oliveira BA, de Pinhel MA, et al. Influence of excess eeight loss and weight regain on biochemical indicators during a 4-year follow-up after Roux-en-Y gastric bypass. Obes Surg. 2015;25(2):279–284.
  14. Pereira P, Guenzi M, Guirat A, Chevalier JM. Weight regain after Roux-en-Y gastric bypass: loss of restriction? Surg Obes Relat Dis. 2013;9(6):1025–1026.
  15. Zak Y, Petrusa E, Gee DW. Laparoscopic Roux-en-Y gastric bypass patients have an increased lifetime risk of repeat operations when compared to laparoscopic sleeve gastrectomy patients. Surg Endosc. 2016;30(5):1833–1838.
  16. Hussain A, El-Hasani S. Gastric stomal ulcers following Roux-en-Y gastric bypass. Obes Surg. 2014;24(12):2171.
  17. Bhayani NH, Oyetunji TA, Chang DC, Cornwell EE, 3rd, et al. Predictors of marginal ulcers after laparoscopic Roux-en-Y gastric bypass. J Surg Res. 2012;177(2):224–227.
  18. Biagioni MF, Mendes AL, Nogueira CR, et al. Weight-reducing gastroplasty with Roux-en-Y gastric bypass: impact on vitamin D status and bone remodeling markers. Metab Syndr Relat Disord. 2014;12(1):11–15.
  19. Tondapu P, Provost D, Adams-Huet B, et al. Comparison of the absorption of calcium carbonate and calcium citrate after Roux-en-Y gastric bypass. Obes Surg. 2009;19(9):1256–1261.
  20. Duran de Campos C, Dalcanale L, Pajecki D, et al. Calcium intake and metabolic bone disease after eight years of Roux-en-Y gastric bypass. Obes Surg. 2008;18(4):386–390.
  21. Silecchia G, Rizzello M, Casella G, et al. Two-stage laparoscopic biliopancreatic diversion with duodenal switch as treatment of high-risk super-obese patients: analysis of complications. Surg Endosc. 2009;23(5):1032–1037.
  22. Bohdjalian A, Langer FB, Shakeri-Leidenmuhler S, et al. Sleeve gastrectomy as sole and definitive bariatric procedure: 5-year results for weight loss and ghrelin. Obes Surg. 2010;20(5):535–540.
  23. Noel P, Nedelcu M, Nocca D, et al. Revised sleeve gastrectomy: another option for weight loss failure after sleeve gastrectomy. Surg Endosc. 2014;28(4):1096–1102.
  24. Sarela AI, Dexter SP, McMahon MJ. Use of the obesity surgery mortality risk score to predict complications of laparoscopic bariatric surgery. Obes Surg. 2011;21(11):1698–1703.
  25. Sarkhosh K, Switzer NJ, El-Hadi M, et al. The impact of bariatric surgery on obstructive sleep apnea: a systematic review. Obes Surg. 2013;23(3):414–423.
  26. Thomas H, Agrawal S. Systematic review of obesity surgery mortality risk score-preoperative risk stratification in bariatric surgery. Obes Surg. 2012;22(7):1135–1140.
  27. McVay MA, Friedman KE, Applegate KL, Portenier DD. Patient predictors of follow-up care attendance in Roux-en-Y gastric bypass patients. Surg Obes Relat Dis. 2013;9(6):956–962.
  28. Livhits M, Mercado C, Yermilov I, Parikh JA, et al. Preoperative predictors of weight loss following bariatric surgery: systematic review. Obes Surg. 2012;22(1):70–89.
  29. Kinzl JF, Schrattenecker M, Traweger C, et al. Psychosocial predictors of weight loss after bariatric surgery. Obes Surg. 2006;16(12):1609–1614.
  30. Ortega E, Morinigo R, Flores L, et al. Predictive factors of excess body weight loss 1 year after laparoscopic bariatric surgery. Surg Endosc. 2012;26(6):1744–1750.
  31. Cottam A, Billing J, Cottam D, et al. Long-term success and failure with SG is predictable by 3 months: a multivariate model using simple office markers. Surg Obes Relat Dis. 2017;13(8):1266–1270.
  32. Hatoum IJ, Greenawalt DM, Cotsapas C, et al. Weight loss after gastric bypass is associated with a variant at 15q26.1. Am J Hum Genet. 2013;92(5):827–834.
  33. Pedersen HK, Gudmundsdottir V, Pedersen MK, et al. Ranking factors involved in diabetes remission after bariatric surgery using machine-learning integrating clinical and genomic biomarkers. Genomic Medicine. 2016;1:16035.
  34. Courcoulas AP, Christian NJ, O’Rourke RW, et al. Preoperative factors and 3-year weight change in the Longitudinal Assessment of Bariatric Surgery (LABS) consortium. Surg Obes Relat Dis. 2015;11(5):1109–1118.
  35. Compher CW, Hanlon A, Kang Y, et al. Attendance at clinical visits predicts weight loss after gastric bypass surgery. Obes Surg. 2012;22(6):927–934.
  36. Abu Dayyeh BK, Lautz DB, Thompson CC. Gastrojejunal stoma diameter predicts weight regain after Roux-en-Y gastric bypass. Clin Gastroenterol Hepatol. 2011;9(3):228–233.
  37. Yanos BR, Saules KK, Schuh LM, Sogg S. Predictors of lowest weight and long-term weight regain among Roux-en-Y gastric bypass patients. Obes Surg. 2015;25(8):1364–1370.
  38. Benoit SC, Hunter TD, Francis DM, De La Cruz-Munoz N. Use of bariatric outcomes longitudinal database (BOLD) to study variability in patient success after bariatric surgery. Obes Surg. 2014;24(6):936–943.


Tags: , , ,

Category: Current Issue, Original research

Comments are closed.