Background

Obesity is a complex but treatable disease with major individual and societal consequences. Although the World Health Organization (WHO) has emphasized the role of society as well as the individual in preventing obesity, the global prevalence close to tripled between 1975 and 2016 [1]. The Global Burden of Disease Study has recently established that obesity is indeed a major global health challenge, demanding population-wide but country-specific initiatives to mitigate the burden of a wide range of diseases [2].

As formulated by WHO, the fundamental cause of obesity and overweight is an energy imbalance between calories consumed and calories expended against a background environmental and societal factors [1]. There are also links to numerous medical and socioeconomic conditions, e.g., psychiatric, endocrine and cardiovascular disorders [3, 4], which in some cases can presumably be mediated via behavioral, inflammatory and vascular pathways [5]. It is thus quite possible that different mosaics of biological and environmental factors in different individuals, contribute to the development of the disease.

Artificial intelligence in the form of machine learning is increasingly used to discern single factors, or combinations of factors, of importance for defining disease or predicting outcomes. Machine learning techniques are well suited to handle large amounts of data, including variables not commonly used to assess risk in clinical practice, and to identify the smallest number of variables needed for accurate prediction. The use of this method has, e.g., been used to explain variations in obesity prevalence between counties, based on demographic, socioeconomic, health care, and environmental factors [6].

The BASUN study is an ongoing prospective cohort study that follows close to 1000 individuals accepted for treatment of obesity, medical or surgical, in clinical practice in Region Västra Götaland, Sweden for 10 years [7]. An important aim of BASUN is to compare effects and complications of surgical and medical treatment of obesity but the overall goal is to improve the care of individuals with obesity as well as reduce adverse outcomes of treatment. In this study, we applied machine learning algorithms on the extensive clinical information (most of which is not collected in studies in the obesity domain) available for the participants of BASUN. The specific aim of this analysis was to seek out factors strongly linked to severe obesity. In turn such factors can be hypothesis-generating, and can be addressed during the follow-up of BASUN, as well as in prospective trials and clinical practice.

Methods

Study design and participants

The design of the BASUN study and the recruited patient cohort have been recently described [7]. To summarize, it is a prospective non-randomized cohort study that originally included 1127 individuals with BMI 35 kg/m2 or higher referred for treatment of obesity in clinical practice in Region Västra Götaland, Sweden, between May 2015 and November 2017. Patients were offered medical or surgical treatment of obesity, based on their wishes and whether they met the usual criteria for the different treatment options. The treatment options have been described in detail [7] and included medical treatment with very low energy diet (VLED) for 12–20 weeks followed by an energy restricted diet up to 12 months or surgical treatment (Roux-en-Y gastric bypass (RYGB) or sleeve Gastrectomy (SG)). Apart from regular clinical visits, follow-up according to the study protocol is planned at 2, 5 and 10 years. The Ethical Regional Board of Gothenburg, approved the protocol (application 673–14). Informed consent to participate was obtained from all study participants.

Anthropometric and laboratory measurements

Demographic data, measurements on height and weight as well as blood tests were collected before the start of treatment. Some blood samples that were important for treatment decisions were analysed directly, while other samples were stored in a biobank [7].

Questionnaires

We used questionnaires to cover three main areas: gastrointestinal symptoms and eating habits, physical activity and quality of life, and psychological health (previously summarized [7]). The questionnaires included to investigate eating habits were the 21-item Three Factor Eating Questionnaire (TFEQ-R21) [8] and the Questionnaire on Eating and Weight Patterns-Revised (QEWP-R) [9]. To gather information on physical activity and quality of life, the Saltin Grimby (SGQ) physical activity level questionnaire [10], the RAND-36 questionnaire [11], and EuroQol five-dimensional questionnaire (EQ-5D) [12] were included. Two questionnaires were included to investigate psychological health, the Becks Anxiety Inventory (BAI) [13], for the measurement of severity of anxiety and the Patient Health Questionnaire-9 (PHQ-9) [14], a self-reported measure of depression. The Alcohol Use Disorders Identification Test (AUDIT) [15], was used to identify individuals with harmful patterns of alcohol consumption.

Statistical analysis

Data analysis were performed using R (R Foundation for Statistical Computing, version 4.0.3). Continuous variables are reported as mean (SD) and categorical variables as numbers (n) and proportions (%). Standardized mean difference (SMD) were used to compare group characteristics; SMD is the difference between sample means divided by their pooled standard deviation. A SMD of less than 0.1 was considered non-significant.

The machine learning algorithm random forest has become more common in medical research [16] and was used here to examine the importance of over 100 clinical variables as predictors for body mass index (BMI). Because of the large number of input variables, using fully parameterized regression models would be difficult because of the risk of overfitting. Using random forests with a large number of trees has been shown to be effective in prediction without overfitting.

The variables were also divided manually into 15 clinically similar domains (Socioeconomic status, Age/Sex, Lifestyle and habits, Metabolic disease, Cardiovascular disease, Potential anxiety/depression, Biomarkers for cardiovascular disease and diabetes, Other biomarkers, Medication for cardiovascular disease or diabetes, Psychiatric disease, Gastrointestinal disease, Endocrine conditions, Musculoskeletal disease, Previous surgery and Other conditions). The predictive values of the different domains were assessed as well as the predictive value of each individual variable. Three thousand trees were used for each binary classification model.

The variable importance (described by van der Laan [17]) was computed using a conditional permutation scheme which minimizes the effect of correlation between variables and reliably reflects the impact of each variable [18]. Using random forest variable importance measures include not only the impact each variable individually but also in multivariate interactions with other included variables. Each variable is permuted (removed) randomly and the effect of this permutation on the prediction accuracy is assessed. The variable importance is thus estimated using the difference of accuracy before and after the variable was permuted. Permuting the variable removes the association between that particular variable and the outcome and for important variables, the accuracy of the model decreases. The value of the importance is arbitrary and has been derived from quantifying the change in accuracy by permutation. The permutation accuracy importance used in this manuscript was developed by Strobl and colleagues [18]. A fully adjusted random forest model was also used to analyse and visualize the relationship between the 10 strongest predictors and BMI. These models included 1500 trees. Missing data was handled using multiple imputation by chained equations (MICE) algorithm (mice package in R). Supplementary Figure 1 shows a graphic description of the results before and after imputation.

Results

The final study population eligible for follow-up in the study and included in this analysis consisted of 1127 individuals of which 971 subsequently started treatment (medical treatment (n = 382), RYGB (n = 388) and SG (n = 201); Table 1). After inclusion, 156 individuals chose not to continue to treatment but are included in the analyses. There were more women in all treatment groups. There were minor differences in mean BMI and age (SMD > 0.1). The majority of the study population was born in Sweden. Using a non-adjusted model, the differences in BMI levels between the sexes and between individuals born in Sweden and outside of Sweden were more pronounced.

Table 1 Characteristics of the BASUN population at baseline

There were differences with regard to marital status and education as well as nicotine usage (SMD > 0.1) With regard to previous diabetes, the groups were similar (SMD < 0.1) but there were slight differences in other reported metabolic disease (hyperlipidemia, hypertension and sleep apnea) (SMD > 0.1) as well as levels of HbA1c, glucose and low-density lipoprotein. Information on previous psychiatric illness was self-reported in questions on known diagnosis and pharmaceutical treatment as well as specific questionnaires. Self-reported previous depression or anxiety and treatment for these disorders differed between the groups as well as the results from the questionnaires focusing on depression (PHQ-9) and anxiety (BAI). There was also a difference in reported usage of antipsychotics between the groups. Factors that might influence the choice of bariatric surgery, such as hemoglobin levels, known deficiencies of vitamins and minerals, eating habits assessed by TFEQ and QEWPR questionnaires, AUDIT scores or previous malignancies were not different between the treatment groups (SMD < 0.1) but there was a difference in known gastrointestinal-, pulmonary- and cardiovascular disease.

The relative importance of the 15 clinical domains and an overview of the variables included in each domain can be seen in Fig. 1. The distribution of variables within each domain can be seen in more detail in supplementary Table 1. The strongest predictive domains observed were: Socioeconomic status, Age/sex, Other biomarkers (hemoglobin, calcium, TSH, T4, liver transaminases, creatinine), Lifestyle and habits, Biomarkers for cardiovascular disease and diabetes (HbA1c, glucose, TG, HDL, LDL, urinary albumin), Potential anxiety and depression, Metabolic disease, Medication for cardiovascular disease or diabetes and Other conditions. The six remaining domains that had little or no predictive value.

Fig. 1
figure 1

Predictive value of each clinical domain on BMI as computed using a conditional permutation scheme and the variables included within each domain. CV: cardiovascular, DM: diabetes mellitus, Hgb: hemoglobin, Ca: calcium, TSH: thyroid stimulating hormone, T4: thyroxine, ASAT: aspartate aminotransferase, ALAT: alanine aminotransferase, TFEQ: three factor eating questionnaire, QEWPR: Questionnaire on eating and weight patterns, AUDIT: Alcohol use disorders identification test, EQ. 5D: EuroQol five-dimensional questionnaire, SGQ: Saltin Grimby questionnaire, HbA1c: glycated hemoglobin, BG: blood glucose, TG: triglycerides HDL: high density lipoprotein, LDL: low-density lipoprotein, U-Alb: urinary albumin, BAI: Beck anxiety inventory, PHQ-9: Patient health questionnaire-9, IHD: ischemic heart disease, HF: heart failure, VTE: venous thromboembolism, PPI: proton-pump inhibitors, ADHD: attention deficit and hyperactivity disorder

The 10 individual variables with the strongest predictive value, in order of decreasing strength, were country of birth, marital status, sex, calcium levels, age, levels of TSH and HbA1c, AUDIT scores, binge eating reflected by the QEWPR questionnaire and levels of TG (Fig. 2). The relationship between these 10 variables individually and BMI is graphically presented in Fig. 3. According to the random forest model being born in Sweden, male sex and younger age seem to be associated with higher BMI levels as well as a self-reported tendency of binge eating. Higher levels of triglycerides and thyroid stimulating hormone were also predictors for higher BMI as opposed to lower levels of calcium and HbA1c. For the largest part of the population there was an inverse relationship between AUDIT scores and BMI. Being married (status 1) was associated with lower BMI levels in comparison with living in cohabitation without being married (status 2), a relationship without cohabitation (status 3), being single (status 4) or living with parents (status 5).

Fig. 2
figure 2

Relative importance of individual predictors on BMI as computed with a conditional permutation scheme. CV: cardiovascular, DM: diabetes mellitus, Hgb: hemoglobin, Ca: calcium, TSH: thyroid stimulating hormone, T4: thyroxine, ASAT: aspartate aminotransferase, ALAT: alanine aminotransferase, TFEQ: Three factor eating questionnaire, QEWPR: Questionnaire on eating and weight patterns, AUDIT: Alcohol use disorders identification test, EQ. 5D: EuroQol five-dimensional questionnaire, SGQ: Saltin Grimby questionnaire, HbA1c: glycated hemoglobin, BG: blood glucose, TG: triglycerides HDL: high density lipoprotein, LDL: low-density lipoprotein, U-Alb: urinary albumin, BAI: Beck anxiety inventory, PHQ-9: Patient health questionnaire-9, IHD: ischemic heart disease, HF: heart failure, VTE: venous thromboembolism, PPI: proton-pump inhibitors, ADHD: attention deficit and hyperactivity disorder

Fig. 3
figure 3

The ten variables with the strongest predictive value for body mass index as analyzed and visualized by random forest. 10% of the population presented by each marking on the x-axis where relevant. Marital status: 1) married, 2) cohabitation, 3) relationship without cohabitation, 4) single, 5) living with parents. TSH: thyroid stimulating hormone, AUDIT: Alcohol use and disorders identification test, QEWP-R: Questionnaire on eating and weight patterns-revised

Discussion

In this study of the baseline characteristics of the BASUN population we found that variables associated with socioeconomic status, age, sex, lifestyle and habits are the strongest predictors for BMI levels. Potential depression and anxiety according to questionnaires also have strong predictive values, stronger than self-reported diagnoses or pharmaceutical treatment of these disorders. The predictive values of clinical laboratory measurements such as serum triglycerides and HbA1c, but also to TSH and serum calcium levels were strong. These results confirm previously suggested associations [19,20,21], but also advocate prospective studies to examine the value of better characterization of patients eligible for obesity treatment, and consequently to evaluate the treatment effects in these groups of patients.

A systematic literature review of machine learning (ML) tools in predicting childhood obesity recently concluded that ML algorithms such as decision trees and artificial neural networks can accurately predict childhood obesity [22]. ML algorithms created to predict obesity in young children mainly focus on height and weight at young age [23], while external factors have been shown to have minor or no influence [24]. Models that focus on predicting obesity in older teenagers have included factors such as eating habits and levels of physical activity [25]. Adult obesity is a complex disease with a multitude of environmental and biological contributing factors. A recent review of various machine learning models used to identify a set of risk factors associated with obesity reported BMI, age, nicotine, blood pressure, blood glucose, lipid profile, adiposity, physical activity, dietary habits and family history as identified risk factors [26]. All of the studies had obesity or overweight as the outcome, not BMI as included in the present study. Models for predicting obesity in adults have to include large magnitude of diverse data. Previous studies have used data from food sales to predict obesity and have shown that the strongest categories in predicting obesity on a country level were baked goods/flours, cheese and carbonated drinks. A reported limitation of this study was that it was unclear if the diet composition was a true cause of obesity or simply a surrogate for sedentary behavior [27]. Predictive decision tree algorithms have also been used to predict metabolic syndrome and to rank behaviors that lead to long-term success after RYGB surgery [28, 29] and data from the Scandinavian Obesity Surgery Registry has been used to compare the capability of different machine learning algorithms in predicting severe complications of surgery. Although the algorithms performed well on the training data, none of the methods included successfully predicted these outcomes when applied to data outside of the training set, indicating the difficulty of applying results from such analyses to real life [30].

The majority of the participants included in our study have similar BMI. Some of the variables presented as having high predictive value, such as liver transaminases, triglycerides and HbA1c levels are more likely to be secondary to obesity. The extreme levels of TSH were only seen in a small percentage of participants with the majority of individuals having levels closer to normal range. The relationship between untreated hypothyroidism and higher BMI levels is not surprising, but the relationship between calcium and BMI was not. Higher BMI is more likely to be associated with lower calcium levels because of relative vitamin D deficiency in individuals with obesity due to d-vitamin sequestration in adipose tissue [31]. Generally, being married has been related to higher BMI levels although this has been shown to differ by gender, age and even ethnicity in studies based on data from the United States [32]. Our results indicate that being married is related to lower BMI levels. The largely Swedish population and lack of variety in ethnicity might in our study explain these differences in comparison to other studies. The value of education as an individual predictor was much lower than many of the other variables although the ‘Socioeconomic status’ domain was the strongest predictive domain. This suggest that it is the actual combination of certain factors that matters.

The high predictive value of answers from questionnaires indicates the importance of these in the evaluation and treatment of individuals with obesity. Scores from the PHQ-9, QEWPR and AUDIT questionnaires were shown to have much higher predictive value than self-reported psychiatric disease or pharmaceutical treatment for anxiety and/or depression. The population included generally reported a low level of physical activity according to the Saltin Grimby questionnaire, with 90–95% of the patients reporting sedentary or low levels of activity only. However, this variable was not one of the individual variables with the strongest predictive value. When the effect of levels of TSH and liver transaminases are considered within the ‘Biomarkers, other’ domain, it is likely that the predictive effect of this domain might be misleading as these markers are more likely to be secondary to obesity. This might also be the case with the effect of TG levels within the ‘Biomarkers, CV/DM domain’.

The prevalence of obesity differs between men and women to varying degrees in different parts of the world. The reasons for this are considered to be multifaceted [33]. In the present study, as well as studies on obesity in general, there were more women, but we observed extremely high BMI levels in younger men and the average BMI was higher among the men. A higher mean pre-operative BMI in males has been reported previously [34]. The inverse relationship between age and BMI as well as the fact that most of the individuals included had normal HbA1c levels might explain the observed association of higher BMI levels with lower HbA1c levels as poor glycemic control might not yet have developed in the younger individuals. The fact that the difference in BMI levels between the sexes and depending on country of birth were more pronounced using a non-adjusted model indicate that at least some of the associations of sex and country of birth are mediated by other factors.

A strength of the present study is the use of a large number of diverse validated variables, including socioeconomic information, biomarkers, psychiatric health, eating habits, alcohol, nicotine, levels of physical activity, previous diseases as well as pharmaceutical treatment. The study includes close to 1000 patients and planned long-term follow-up. The choice of treatment is based not only on clinical guidelines but also on the patient’s preferences. This approach reflects the treatment as it is in clinical practice. The BASUN study includes a heterogenous population of individuals with obesity, not only focusing on established comorbidities. The population included can be considered representative and is comparable to participants in other larger obesity treatment studies such as the Swedish Obese Subjects (SOS) ( [35]), as well as the OPTITWIN [36], DIETFITS [37] and POUNDS LOST studies [38]. All of these included a predominantly female population and similar age groups (39–52 years). The BMI levels in the SOS study were also between 41 and 42 kg/m2 but slightly lower in the other studies (33–39 kg/m2). Our statistical methods, random forest variable importance measure, covers the impact of each predictor as well as multivariable interactions, and using conditional random forest models has the advantage of minimizing the effect of correlations between different variables.

There were also limitations in the study. The individuals included in this study have been referred and accepted for treatment of obesity. The population might therefore differ from the general overweight population seen in society in general as well as in clinical practice in other settings, which can limit the external validity. The differences in certain baseline characteristics were expected due to non-randomization. The study is largely based on self-reported data and there is a risk that individuals that have the most severe psychiatric disorders will not answer the questionnaires or that individuals that do not succeed with their treatment might not report back during the follow-up period. This might introduce bias. There might be a certain economic aspect in the choice of treatment as participants included in the medical treatment group pay for the VLED products themselves. Information on income or employment status was not included, but the VLED diet is not more costly than a normal diet and there were only minor differences between the groups with regards to education and marital status which could reflect economic status to some degree. An inclusion criterion for the study was that participants could understand Swedish which excluded some participants with country of birth other than Sweden, and we have not collected genetic data or the family history of the patients.

An important aim of the analysis in the present study was to seek out variables that could be hypothesis generating and useful in early risk prediction of obesity. Before the results of our study can be applied directly in clinical practice, further studies are needed. However, the factors with the strongest predictive value described in this study, such as scores from questionnaires may be of value when choosing treatment options for obesity, both medical and surgical. Comparing different types of ML methods on the BASUN data and dividing the population by class of obesity might be of value. Prospective studies using ML techniques including individuals that are overweight and not yet obese, might also add valuable information on predictive factors for obesity. Planned analyses of follow-up data from BASUN will be used to find predictive variables for successful obesity treatment.

Conclusions

Variables associated with lifestyle, habits, age, sex and socioeconomic status are the strongest predictors for BMI levels. Self-reported anxiety and depression through questionnaires also have strong predictive value, stronger than self-reported diagnosis or pharmaceutical treatment of these disorders. We propose that future studies should examine the value of wider characterization of patients treated for obesity.