**4. Discussion**

To the best of our knowledge, this is the first study attempting to examine the value of socio-demographic and clinical factors for the prediction of SUD in a large, naturalistic sample of adults with BD using a machine-learning approach.

Using a random forest classifier, we developed models to predict the presence of SUD, AUD, or the co-occurrence of AUD and other SUDs in BD. Although the specificities of the models were acceptable, their accuracies were low to moderate. The comparison of the performance of our models with previously developed models is limited by the scarce evidence on the topic [20].

The model with the highest accuracy was the one predicting the co-occurrence of another SUD among individuals with AUD and compared with those without SUD, correctly classifying up to 75% of the sample. The top features were similar among the four random forest models and included clinical factors associated with a severe course of illness in BD, such as the lifetime number of affective episodes and the respective episode polarity [43], type of index episode [44], the presence of comorbid cluster B personality disorder [45], and suicide or aggressive behavior [46]. It should be remarked that the top features extracted might be highly correlated with other relevant variables associated with poor BD outcomes (e.g., presence of psychotic symptoms, and low socioeconomic status) [47,48], thus hindering their effect on SUD prediction. However, the effect of other variables could be considered minimal compared with that of the selected top features [49]. While we

found similarities among the top features identified by the RF models, their association with SUD comorbidities varied among the logistic regression models.

A lifetime comorbid diagnosis of cluster B personality disorder and not being in a relationship predicted the presence of SUD vs. no-SUD. This result is not surprising as SUD, cluster B personality disorders, and BD are characterized by impulsivity and poor behavioral control [50–52]. The complex phenotypic overlap between BD and cluster B personality disorders is a clinical challenge [53], with problematic clinical and genetic boundaries [54], frequently leading to a misdiagnosis of BD in people with personality disorders, such as borderline personality disorder (BPD) [55,56]. The risk of substance use and abuse in individuals with BD and comorbid BPD is two to three times higher than in individuals with BD alone [57]. This could be possibly justified by an even higher tendency toward risky behaviors, mood instability, impulsivity, affective reactivity, and context-specific increased sensitivity to rewards in patients with comorbid BD and BPD, ultimately leading to substance misuse [58]. Another variable associated with SUD risk is the lack of a stable relationship, which is in line with previous evidence [59]. Similarly, socio-economic functioning is substantially decreased in patients with BD, with lower odds of being in a stable relationship compared with the general population (Sletved et al., 2021 [60]), while social or family support improves patients' global functioning [61].

Given the extremely high prevalence of AUD in BD and their strong interplay, we analyzed predictors of AUD alone or comorbid with another SUD. The relationship between AUD and BD is complex and comprises shared biological pathways [62], as well as clinical and psychological characteristics [63]. However, previous observational studies on AUD in BD were mainly conducted on individuals with a co-occurrence of other SUDs [3,21,64], without clinical phenotyping, based on a distinct pattern of use. After controlling for sex, age of onset, and duration of illness, no other factors were associated with AUD without other SUDs in our sample. However, AUD comorbid with another SUD was positively associated with a history of a hypomanic episode at BD onset and hetero-aggressive behavior compared with non-use, and negatively associated with a history of a depressive episode at BD onset when compared with non-use. The polarity of the first episode has a relevant influence on the course of BD, with the depressive one being the most common and being related to suicide attempts [65], with (hypo)manic being related to alcohol or other substance misuses [44]. Given that polarity at onset might predict subsequent predominant polarity in BD [44,66], its evaluation may guide long-term therapeutic planning [67]. The link between first-episode polarity or predominant polarity, SUDs, and BD requires further analysis in prospective longitudinal studies, as affective episodes may be triggered by substance use, thus influencing lifetime affective episodes of a specific polarity [68]. Aggressive behavior is considered a trait and a state factor associated with BD, often driven/worsened by substance use [52]. Proneness to impulsivity may lead to greater involvement in substance use and an increased risk for criminal, violent, or aggressive acts. However, these premises and the existence of putative common biological underpinnings of aggressive behavior and BD sugges<sup>t</sup> that this undesirable outcome might result from environmental–gene interactions [69].

Individuals that reported substance misuse before the onset of BD are sometimes considered to have a "milder" BD phenotype [70]. In addition, sub-threshold mood symptoms or mood instability might be the result of substance use and might lead to BD misdiagnosis [71]. Therefore, the direction of the association between SUD and BD is relevant, as it might depict two different subpopulations of individuals according to the onset of SUD (i.e., before or after BD onset) with distinct clinical needs. However, our study lacked information about the differences between these subpopulations and the direction of the association. Several other limitations in this study should be considered. The cross-sectional design of the study, as well as the use of clinical variables, collected retrospectively from electronic clinical records, may have affected the accuracy and reliability of our data, particularly regarding previous affective episodes, hypomanic onsets—for which retrospective diagnosis is a clinical challenge—or mixed episodes—for which the DSM definition varied

across the years. Obviously, a longitudinal study would be a better design to test our models [72]. In addition, we only included data on current psychopharmacological treatment, but not on psychosocial, psychoeducational, or other psychological interventions that are highly recommended for comorbid SUD managemen<sup>t</sup> in major guidelines [73] because they improve adherence to pharmacological treatment, leading to a more stable BD course [74]. Secondly, SUD might have been underdiagnosed because of internalized stigma [75]. Given that patients were recruited from a specialized unit, a potential selection bias should also be taken into account, as we could assessed the most severe cases that were ultimately forwarded to a tertiary clinic or, conversely, the less severe ones. Furthermore, when considering lifetime SUD, we might have excluded people with current SUD, thus inflating the risk for Berkson's bias, and ultimately reducing the overall generalizability of the results. Finally, RFs are a "black box", making any local interpretation of a specific prediction quite impractical.

Despite its possible limitations, the present study is the first one to develop algorithms to identify SUD in patients with BD and to describe potential sociodemographic and clinical predictors of comorbidity. Furthermore, our data come from a highly specialized unit, in which patients are regularly followed-up by trained psychiatrists.
