On the advances in machine learning and complex network measures to an EEG dataset from DMT experiments

There is a growing interest in the medical use of psychedelic substances, as preliminary studies using them for psychiatric disorders have shown positive results. In particular, one of these substances is N, N-dimethyltryptamine (DMT), an agonist serotonergic psychedelic that can induce profound alterations in the state of consciousness. In this work, we use an exploratory tool to reveal DMT-induced changes in brain activity using EEG data and provide new insights into the mechanisms of action of this psychedelic substance. We used a two-class classification based on (A) the connectivity matrix or (B) complex network measures derived from it as input to a support vector machine (SVM). We found that both approaches could detect changes in the brain’s automatic activity, with case (B) showing the highest AUC (89%), indicating that complex network measurements best capture the brain changes that occur due to DMT use. In the second step, we ranked the features that contributed the most to this result. For case (A), we found that differences in the high alpha, low beta, and delta frequency bands were most important in distinguishing between the state before and after DMT inhalation, which is consistent with the results described in the literature. Further, the connection between the temporal (TP8) and central cortex (C3) and between the precentral gyrus (FC5) and the lateral occipital cortex (P8) contributed most to the classification result. The connection between regions TP8 and C3 has been found in the literature associated with finger movements that might have occurred during DMT consumption. However, the connection between cortical areas FC5 and P8 has not been found in the literature and is presumably related to the volunteers’ emotional, visual, sensory, perceptual, and mystical experiences during DMT consumption. For case (B), closeness centrality was the most crucial complex network measure. Furthermore, we discovered larger communities and longer average path lengths when DMT was used and the converse when not, showing that the balance between functional segregation and integration had been disrupted. These findings support the idea that cortical brain activity becomes more entropic under psychedelics. Overall, a robust computational workflow has been developed here with interpretability of how DMT (or other psychedelics) modify brain networks and insights into their mechanism of action. Finally, the same methodology applied here may help interpret EEG time series from patients who consumed other psychedelic drugs.


Introduction
N, N-dimethyltryptamine (DMT) is a substance endogenously produced in various mammals [1], including humans [2], and has serotonin agonist properties.Thus, it can bind to serotonin receptors, simulating the neurotransmitter [3].In [4], it was for the first time suggested that the pineal gland produces DMT in stress situations such as birth and death.In [5,6], it seems clear that it is produced in small quantities by this gland [7].
The substance was first synthesized in 1931 [8], while its psychoactive effects were described for the first time many years later in 1956 by [9].When administered externally in large quantities, DMT can cause altered states of consciousness [10], hallucinations [11][12][13] and spiritual experiences such as communication with 'presences' or 'entities' , plus reflections on death [14].Exogenous ingestion can be done by smoking or injecting.Its effect by oral ingestion depends on the inhibition of monoamine oxidase, an enzyme that degrades the alkaloid DMT in the liver and intestine [12].This enzyme and DMT are also present in ayahuasca tea, which has been used in the Amazon for hundreds of years as part of the traditional medicine of the region's inhabitants [15].
Recently, there has been a surge in interest in the medicinal application of psychedelics.Only last year, in [16], around 100 psychedelic clinical studies are presently being done globally.This represents increased clinical trials compared to the 43 aided psychedelic treatment clinical studies done since 1999.One example is the psychedelic 3,4-methylenedioxymethamphetamine which is already in phase 3 clinical trials for the treatment of post-traumatic stress disorder (PTSD) [17] and significant depression with positive results [18].Another notable example is psychedelic psilocybin, whose therapeutic use in the U.S. has come to be considered a revolutionary therapy for treatment-resistant depression and major depressive disorder [19].These first promising results suggest that other psychedelic substances, such as lysergic acid diethylamide (LSD), ibogaine hydrochloride, salvia divinorum, 5-MeO-DMT, ayahuasca, and DMT, which have been less studied so far, should be investigated in more detail [20].
Only a few studies on administering micro-or low-dose DMT to non-human species (predominantly rats) have been published in the scientific literature [21].In [22], a low dose of DMT was administered to rats resulting in changes in frequency and amplitude of spontaneous excitatory postsynaptic currents in the prefrontal cortex (PFC) that lasted long even after the drug was removed from the body.In [23], it was described that chronic, intermittent, low doses of DMT produced an antidepressant effect and increased fear extinction learning in rats without affecting working memory or social interaction.For a high amount of DMT (10 mg kg −1 ), an increase in the density of the dendritic spines in the PFC was found in rodents, and antidepressant and anxiolytic behavioral effects were observed [24].In humans, a single dose of 0.1 mg kg −1 of DMT caused an apparent anxiolytic effect shown in [25].However, other studies using inhaled 5-MeO-DMT also observed complete mystical experiences in 75% of volunteers [26] and improvements in depression and anxiety, which were associated with greater intensity of mystical experiences, with the spiritual and personal meaning of the experience, when using this substance [27].
Thus, there is evidence that DMT can help with depression and PTSD.However, most studies have been conducted on animals and, therefore, only have a reduced power.Therefore, more in-depth studies on DMT, its mechanisms in the brain, and its potential clinical effects in humans are needed since there are few studies investigating the use of DMT in humans through EEG [28][29][30] and fMRI [31].
Despite DMT's significant therapeutic potential, there are just a few human studies in the literature, and additional study on how this substance modifies the brain and its mechanism of action is required.
Graph theory methods yielded interesting insights into the complex network structure of the human brain.It is known from the literature [32][33][34][35][36][37] that the topology of the brain is a small world network.This type of network has connectivity properties that are intermediate between random and regular graphs, preserving a high degree of connectivity between local neighborhoods while allowing all of its nodes to be connected via remarkably short pathways [32,38].They also preserve a high degree of connectivity between local neighborhoods while allowing all their nodes 6 which to be connected to surprisingly short paths [32].Altering this topology is also associated with pathological states [39][40][41][42], and the use of substances such as psychedelics [43][44][45].Notably, complex network parameters have been used as a biomarker for several diseases [46,47].In addition, complex networks are widely used in EEG to characterize the brain functional networks [48][49][50][51].
In this context, machine learning (ML) has been used for more accurate, and automatic medical diagnosis [52][53][54][55][56][57][58][59].Compared to traditional statistical techniques, this approach has the advantage of not relying on prior assumptions (such as adequate distribution, observation independence, absence of multicollinearity, and interaction problems) and is suited to automatically analyze and capture complex non-linear relationships in data [60,61].As brain data are characterized by high complexity and highly correlated brain regions, ML algorithms have been widely used to detect acute and permanent abnormalities in the brain [62][63][64].On the other hand, ML shows a lack of interpretability and a black-box nature that is an especially disadvantageous general limitation when it comes to an understanding medical data [65,66].In recent years, new techniques have emerged to help interpret ML results.Most notable is the SHapley Additive ExPlanations (SHAP)values method [67].This metric enables the identification and prioritization of features and can be used with any ML algorithm [68][69][70].
While our study predominantly employs traditional ML algorithms, we acknowledge the remarkable strides made by deep learning in EEG decoding.For example, in [71][72][73][74] have demonstrated the efficacy of interpretable deep neural networks in automatically identifying relevant spatial and frequency neural signatures from EEG data.These studies illustrate the potential of deep learning models, incorporating interpretability, to decode intricate brain states, such as motor execution and P300 responses.Additionally, deep learning frameworks employing explainable techniques, such as saliency maps, layerwise relevance propagation, and SHAP, have been instrumental in unraveling complex EEG patterns [71,[75][76][77][78][79][80].These frameworks enhance a deeper understanding of brain function and connectivity by decoding EEG signals and providing insights into the neural mechanisms underlying specific brain activities.
The present work aims to investigate EEG data using ML as an exploratory tool to detect temporal changes in the brain functionality of participants after DMT consumption.The study raised the following research questions: • Can we automatically detect changes in the functional network structure induced by DMT using ML?
• Which new insights into the mechanisms of action of DMT can we draw when we use ML in combination with SHAP values?
To answer these questions, we use the same methodology implemented in [81], which proposes a two-class classification based on (A) the connectivity matrix or (B) complex network measures derived from it as input to a support vector machine (SVM) [82].SVM has been used with excellent results for classifying complex network measures before [51,83,84].Furthermore, this ML algorithm can handle problems where the sample size of the data is generally smaller in comparison to the dimensionality of its feature space and is therefore applicable to the study of brain disorders with neuroimaging [85], whose data have these characteristics, and also this is the case of the data in this work (the case A with connectivity matrix).Moreover, we determine which abstraction levels are most suited for EEG recording DMT-induced brain changes.In contrast to the previous study [81], which uses gamma-band frequencies in EEG from ayahuasca experiments.This study advances the methodology used before since different frequency bands are also considered to see the best frequencies to differentiate brain changes due to DMT.For a biological interpretation of the DMT-induced changes, the SHAP value technique has also been demonstrated to be more successful than the research described above in identifying the best connections between brain areas and the best complex network measures, which helps understand the effects of the psychedelic substance on the brain.
A robust workflow has also been applied for interpreting brain network modifications due to DMT (or other psychedelics) in these two data abstract levels.

Data
The data used for this study has been published in [86] and is publicly available in a raw format 7 .Thirty-five healthy male and female subjects (7 women and 28 men) volunteered to inhale, using pipes, 40 mg of free DMT extracted from the root of Mimosa hostilis.It should be noted that all participants had previous experiences with ayahuasca.Recordings were made with 24 electrodes, following the EEG electrode positions in the standard 10-20 location system.These channels are Fp1, Fp2, Fz, F7, F8, FC1, FC2, Cz, C3, C4, T7, T8, CPz, CP1, CP2, CP5, CP6, TP9, TP10, Pz, P3, P4, O1, and O2.In addition, reference and ground electrodes were placed at FCz.The recordings on the subjects started 10 min before DMT inhalation, 5 min with eyes closed, and 5 min with eyes open.After DMT use, subjects were recorded for about 6 min (6 ± 1.4 min) with eyes closed.Here, we used solely the eyes-closed data for the pre-and post-DMT inhalation (control) groups.

Methodology
In an earlier work of the authors [81], ML, in combination with complex network measures, was successfully applied to EEG data recorded after ayahuasca consumption to detect changes in brain activity.For this purpose, different levels of data abstraction were used as input: (a) the raw EEG time series, (b) the correlation of the EEG time series, and (c) the complex network measures calculated from (b).Several ML algorithms were tested, and the best performance was obtained with the SVM at abstraction levels (b) and (c).Based on this result, we decided to use in the present work connectivity matrices (see section 3.2) and derived complex network measures (see section 3.3 as input for an SVM).
More details are displayed in figure 1, which summarizes the methodology workflow.In short, EEG time series were separated by filtering in eight frequency bands.In the next step, preprocessing of the EEG time series was performed to obtain the connectivity matrices for each frequency band (and the unfiltered signal); see figures 1(A) and (B) with details of this process described in sections 3.1 and 3.2.In a second step, complex networks measures are derived from the connectivity matrices as described in section 3.3, see figure 1(C), and both types of data sets were used as input to an SVM as described in section 3.4.Finally, for interpretation of the classification results, the feature ranking algorithm SHAP is finally applied as described in section 3.5.

Data preprocessing
First, a high-pass filter with a cut-off frequency of 0.5 Hz was used to remove artifacts such as electro galvanic signals and motion artifacts [87].This type of filtering is widely used in the literature [88][89][90][91].To remove eye artifacts, we employed an independent component analysis (ICA) approach in which EEG signals are decomposed to maximize independent components, and those with eye activity were identified and eliminated [92].An example of the ICA analysis for a subject using DMT can be seen in figure 2. This analysis was done with a python package called MNE [93] using an algorithm based on maximum information (Infomax) perspective [94].

Connectivity matrices
The well-known Pearson correlation calculated connectivity matrices.It is a widely used and successfully approved measure to capture the correlation of EEG electrodes [95][96][97][98][99][100]. The choice of Pearson's correlation as the connectivity metric was based on our previous study [81] on ayahuasca experiments, in whose main compound is DMT, showcased that this metric successfully delineates the nuanced changes in brain activity associated with psychedelic substance consumption.Further, the same metric was usefully used in other psychedelic studies [101,102].
The Pearson correlation was calculated for all electrode pairs and all frequency bands.The connectivity matrices serve as input for the following steps described in sections 3.2 and 3.3.Noteworthy is that a single Pearson's correlation matrix is generated for each frequency band, participant, and DMT-inhalation condition, encompassing the entire 5-6 min of continuous recording.
Therefore, it was obtained for all frequencies and groups 560 connectivity matrices after filtering in different bands.It's crucial to note that this filtering process inherently expanded our dataset, serving as a form of data augmentation.By extracting these frequency-specific features, we essentially augmented the richness and granularity of our dataset, allowing for a more nuanced understanding of the brain's activity before and after DMT consumption.
The connection matrices were flattened into a single vector before being fed into the ML algorithm.The vectors were then successively combined into a 2D matrix, with each column representing a link between two electrodes and each row representing a person.For each frequency band, such 2D matrices were created (and the unfiltered signal).

Complex network measures
A complex network graph was generated for each connectivity matrix to extract different measures.To construct the graphs, we normalized the connectivity matrix between 0 and 1, and connections bigger than 0.5 were binarized to 1 and smaller ones to zero.This way, the generated graph is undirected and weightless.This undirected and weightless graph was taken was considered since the Igraph package [103] that we used to extract the complex network measures includes a more significant number of complex network measures for binary graphs, and the ML approach works better with a large number of features.In (A) Data preprocessing, described in the section 3.1, the EEG time series are filtered to remove artifacts (in the picture, the time series of a subject at the time the DMT was used) and then separated into the frequency bands high alpha, low alpha, high beta, mid-range beta, low beta, gamma, delta, and theta (as an example in the picture the topographic map for the frequencies high alpha and high beta for the same subject).For each band, the correlation between the channels is calculated using Pearson's correlation to obtain a 24 × 24 connectivity matrix.In (B) Connectivity matrices, described in the section 3.2, where the connectivity matrices are flattened into a vector that is put into the SVM to verify the most important connections with the use of DMT (in the figure the best performing model, using the high alpha, low beta, and delta bands, found TP8 and C3 as the primary connections).In (C) complex network measures, described in the section 3.3, where the connectivity matrices are analyzed as graphs (in the figure for the same subject, the diagram for the frequencies high alpha and high beta, where the number of connections in each node varies according to the color bar) and from them have extracted measures of complex networks that are applied in the SVM and the best model found for the delta frequency found the closeness centrality (CC) as the main measure.
Furthermore, many recent studies [97,104] have excluded weighted edges, turning them into binary edges, since weightless networks are simpler to characterize and there are many more measures, from complex networks to weightless networks.In addition, removing weights still eliminates weak, meaningless edges, which can be seen as noise in functional and effective networks [105].
To feed the data into the ML algorithm, the complex network measures retrieved from the created graphs were stored in a matrix, with each column being a complex network measure and each row representing a subject.The following complex network measures were calculated: Assortativity [106,107], average path length (APL) [108], betweenness centrality [109], CC [110], eigenvector centrality [111], diameter [112], hub score [113], average degree of nearest neighbors [114], mean degree [115], second moment degree [116], entropy degree (ED) [117], transitivity [38,118], complexity, k-core [119,120], eccentricity [121], density [122], and global efficiency [123].In addition, newly developed metrics (described in detail in [81]) reflecting the number of communities in a complex network are applied.Community detection (also called clustering graph) is one of the fundamental analyses of complex networks aiming to decompose the network in order to find densely connected structures, so-called communities [124][125][126].However, the community detection measures need to be transformed into a single scalar value to include them in the matrix.To this aim, we perform the community detection algorithms to find the largest community, then calculate the APL within this community and receive a single value as a result.The community detection algorithms used were: Fastgreedy community (FC) [127], infomap community (IC) [128], leading eigenvector community (LC) [129], label propagation community (LPC) [130], edge betweenness community (EBC) [131], spinglass (SPC) [132], and multilevel community (MC) [133].To indicate our approach, we extended the given abbreviations by the letter 'A' (for APL) as follows: AFC, AIC, ALC, ALPC, AEBC, ASPC, and AMC.

ML process
All the parameters of the ML algorithms used in this paper and the metrics used to evaluate the model's performance were based on a recent study [81].This study assessed whether it could automatically detect changes in functional brain connectivity due to psychedelic ayahuasca, which presents in its composition the substance DMT.Thus, to classify these two levels of data abstraction, namely the connectivity matrix and the complex network measures, the matrices were sampled by separating them into training (train) and test sets, with 25% of the data composing the test set.Then, for a reliable model, k-fold cross validation was used [134], with k = 10 (value widely used in the literature [135][136][137][138][139]).For the training process, the training sets were applied to the SVM.SVM is based on the search for a hyperplane that geometrically divides samples into two classes.Three important hyper-parameters of the SVM have been considered in this work: • Kernel function: also known as kernel trick, has the function of projecting the input vectors in higher dimensions because by increasing the dimension of the problem, the probability of it becoming a linearly separable problem increases, which makes it easier to solve [140,141].• Regularization parameter C: this is the penalty term of the optimization problem and is an added constant that creates flexible margins concerning the optimal hyperplane found.• Gamma: defines how much influence a single training example has.When the gamma value is too small, the model is too restricted and fails to capture the complexity of the data.
To find the best parameters, these hyper-parameters were optimized with the grid search method, widely used in the literature [142][143][144][145][146]. The grid search thoroughly combines all values of the parameters selected for the models using some metrics to evaluate the performance of these combinations, which in the present work was the area under the receiver operating characteristic (ROC) curve (AUC) (for an explanation, see below).Here, we used the following functions as values for the kernel: gaussian (RBF), polynomial (poly), sigmoid and linear.Optimized values for parameters C and gamma are displayed in appendix A.
For evaluation, the standard performance metrics accuracy (Acc.) was used as described in [147][148][149][150][151]. As we have a two-class (negative and positive) classification problem, other metrics like Precision and Recall are considered, also typical in the literature [152][153][154][155]. Precision (also called specificity) corresponds to the negative class's hit rate (here, no effect induced by DMT).Whereas Recall (also called sensitivity) measures how well a classifier can predict positive examples (hit rate in the positive class), here related to an effect of DMT.Another well-known measure, see [143,156,157], is the F1 score which is the harmonic mean of the Recall and precision [158].
For visualization of these two latter measures, the ROC curve is a standard method as it displays the relation between the rate of true positives and false positives.The area below this curve called the area under the ROC curve (AUC) has been widely used in classification problems [145,147,159,160].The AUC value ranges from 0 to 1, with one corresponding to an error-free classification result.For example, AUC = 0.5 indicates that the classifier cannot distinguish the two classes equal to the random choice.Furthermore, we consider the micro average of the ROC curve, which computes the AUC metric independently for each class (calculate the AUC measure for patients before consuming DMT, class zero, and separately for patients after ingesting DMT, class one.)and then the average is computed considering these classes equally.Finally, the macro average is also used in our evaluation, which does not consider both classes equally, but aggregates the classes' contributions separately and then calculates the average.

Feature ranking
As described in section 1, the most notable technique for interpreting ML results is the SHAP values method based on the Shapley value concept, which has its origin in game theory [161,162], where it aims to assign payoffs to players depending on their contribution to the total payoff in the game.In addition, those who cooperate in a coalition receive a certain profit from this cooperation [163].When we apply this method to our ML problem, each feature represents a player in a game, and the prediction represents the reward.Thus Shapley's values tell us how to distribute the payoff fairly among the features [164].
Here, we used this methodology to evaluate which complex network measures and which correlation between electrodes (brain regions) contributed most to the classification result allowing for a biological interpretation of the results obtained with our ML algorithms.

Results
ML was applied for two different levels of data abstraction: (A) the correlation of EEG time series (connectivity matrix) and (B) the complex network measures calculated from (A).We found that both approaches could automatically detect acute changes in brain activity induced by the inhalation of DMT.However, the highest classification performance was obtained for the complex network measures with an AUC of 89% (see table 1).The following sections 4.1 and 4.2 describe the results in more detail.

Connectivity matrix
EEG data recorded from subjects before DMT inhalation (control with eyes closed) and those after inhalation of DMT were filtered and divided into eight frequency bands as described in 3.1.Detailed results for each frequency band are given in the appendix B.  The best performance was achieved for the low beta frequency band (test sample performance with mean AUC of 0.78, mean precision of 0.78, mean F1 score of 0.78, mean recall of 0.78, and mean Acc. of 0.78) followed by the high alpha and delta frequency bands (test sample performance for both frequency band was a mean AUC of 0.72, mean precision of 0.72, mean F1 score of 0.72, mean recall of 0.72, and mean Acc. of 0.72).Then, these connection matrices from the frequencies that performed best independently were inserted again in the ML approach.Moreover, better results were achieved by combining these frequency bands whose test sample performance had a mean AUC of 0.82, mean precision of 0.82, mean F1 score of 0.82, mean recall of 0.82, and mean Acc. of 0.82.Furthermore, see appendix D for the similarity of results obtained for each frequency.
In figure 3, the confusion matrix (figure 3(a)), the learning curve (figure 3(b)), and the ROC curve (figure 3(c)) are displayed.The learning curve evaluates the model's predictability by varying the size of the training set [70].Results show that the entire database is required to achieve the highest validation accuracy.
In order to reveal the importance of the connections between electrode pairs (brain connections) by considering the combination of the best EEG frequency bands (high alpha, low beta, and delta), the SHAP values were calculated.The results are shown in figure 4. The most important connection was between electrodes temporal and parietal region (TP8) and central region (C3).In addition, the presentation of the data in figure 4 shows that for the connection between TP8 and C3, low values of correlation (blue dots) were   value of that connection obtained for a given subject.For example, for the TP8-C3 connection, subjects had low correlation values in the presence of DMT (blue points on the right region of the central axis) and high correlation values in the absence of DMT (red points on the left region of the axis).

Complex network measures
We received the best performance considering complex network measures for the delta frequency band (test sample performance with mean AUC of 0.89, mean precision of 0.91, mean F1 score of 0.88, mean recall of 0.88 and mean Acc. of 0.89); see table 1.Furthermore, the precision measure is related to the positive class (with DMT).Thus, since the precision was higher than the recall, we conclude that the model slightly better detects the presence of DMT than its absence.Furthermore, see appendix D for the similarity of results obtained for each frequency.
In figure 6, the confusion matrix (figure 6(a)), the learning curve (figure 6(b)), and the ROC curve (figure 6(c)) are plotted.Again, the entire database is necessary to get the highest accuracy.All the other results can be found in appendix C.
Based on the SHAP values in figure 7, it can be seen that the essential measure for the model was the CC, followed by the ALPC measure and the APL.In addition, high values of the CC measure (pink dots) indicate its importance for the detection of the absence of DMT (negative SHAP values); see figure 7(b).In contrast, with the presence of DMT, some subjects have low values of CC (blue and purple dots).

Discussion
In the previous sections, we presented a computational workflow, including data preprocessing and an ML algorithm revealing acute differences in brain activity before and after consuming the psychedelic drug DMT.As a result, we achieved a classification accuracy of at least 82%.We further showed that the classification accuracy based on complex network measures (89%) was higher than that based on the connectivity matrix alone (see table 1), suggesting that these measures are important to capture differences in brain activity.Further, we searched for descriptive parameters related to changes in the functional network structure by ranking the importance of features that contributed to the classification result.The results are discussed in this section to get insights into the effects of DMT consumption on the brain in terms of EEG frequency band (section 5.1), the connection of the most activated brain regions (section 5.2), and measures of complex networks (section 5.3).

Frequency bands
With our workflow, we identified these frequency bands, which were mostly modified after the inhaled of DMT.Furthermore, we found that classification results received with the connectivity matrices and the complex network measures are strongly based on acute changes in the delta band.Thus, changes in the delta band were most robust for both input data types.
This observation corresponds to what was also found in the literature [28,86].Delta band activity is usually associated with states where there is no wakefulness, such as sleep [168,169] and coma [170].However, some studies such in [171] observed that the delta frequency is present even when there are behavioral responses, such as in propofol anesthesia, postoperative delirium, and in powerful psychedelic states.Moreover, delta band activity has also been detected in studies involving spiritual experiences [172][173][174], and meditation states [175,176].
Although the increase of delta band activity points clearly to an altered state of consciousness after the inhalation of DMT, other frequency bands were also affected.We found that in addition to delta, high alpha and low beta bands were essential features for the connectivity matrices.This finding is supported by [86], who describes that inhalation of DMT reduces the alpha band activity while increasing the delta and gamma band at the same time [177].According to the authors, the increase in gamma is associated with subjective perceptions typical of mystical experiences.In our data, we observed no changes in the gamma band.

Connection between brain regions
With the connectivity matrices, we found that classification results are strongly based on a decreasing correlation between the temporal/parietal (TP8) and the central brain (C3) region after DMT uptake.These brain areas correspond to the occipitotemporal (Right BA37), primary somatosensory cortex, and motor cortex (Left BA01/02) via Brodmann's map [178].The temporal lobe is associated with the perception and production of speech, hearing, memory, and emotional processes because it is connected to the amygdala and the limbic system [160].The right temporal region, TP8, is associated with recognizing familiar faces, with participation from the frontal cortex [179].Furthermore, in humans, the TP8 region contributes to the global processing of visual information [180].The connection between these two regions, TP8 and C3, is involved in visual and tactile perceptions and finger movements [181,182].
In addition, the correlation between the electrodes frontal region (FC5) and parietal region (P8) contributed significantly to the classification result.These regions correspond to Left BA6 and Right BA19 of Brodmann's map, respectively.The frontal region is involved in cognitive processing, planning behavior, and has connections to the somatosensory cortex, motor, and auditory areas [183,184] and limbic system, and is also involved in emotions.The placement of FC5 electrode encompasses the region of the precentral gyrus in the premotor region, which is responsible for controlling voluntary motor movement of the body.This region also includes a portion of the supplementary motor cortex, responsible for planning the voluntary movement of the limbs [185].The P8 region, on the other hand, is located in the lateral occipital cortex, responsible for integrating different types of information so that our interaction with the environment is efficient, forming representational spaces through perception, semantics, through perception, semantics, and motor functions [186].
Studies using other psychedelics, such as LSD, have found reduced functional connectivity in the anterior medial PFC, and time-specific effects were correlated with different aspects of subjective experiences under the effect of psychedelics [187].Psilocybin consumption, on the other hand, was related to decreased functional connectivity between the medial temporal lobe and high-level cortical regions.The changes found in the cortical regions reported above are related to the visual, sensory, perceptual, and motor type experiences experienced by the volunteers during the use of these two psychedelics (LSD and Psilocybin).
Correlating our findings with previous studies, the FC5 and P8 regions also found here are part of the cortical region, and a possible inference is that they are related to the participants' experience with DMT.In the original study from which the data of our study is derived, the authors [86] applied different scales to evaluate the lived experiences of this study participants.Among the experiences accessed by the volunteers during the use of inhaled DMT, the highest percentages were for elementary imagery (85.27%), blissful (61.77%), complex imagery (50.21%), spiritual experience (49.61%), and disembodiment (47.58%).For the Near-Death Experience scale, it was 60.94% for affect experience.For the Mystical Experience Questionnaire (mystical, positive mood, transcendence of time and space, and ineffability), 46.29% was found.According to authors [86], 13 of 35 participants (equivalent to 37%) accessed a complete mystical experience.Other studies using inhaled 5-MeO-DMT also observed complete mystical experiences in 75% of volunteers [26] and improvements in depression and anxiety, which were associated with greater intensity of mystical experiences, with spiritual and personal meaning, when using 5-MeO-DMT [27].Although these two cortical regions, FC5 and P8, may be related to the participant's sensory and visual experiences when using DMT, an interpretation of the connectivity between these regions has yet to be obtained since there is no information in the literature.

Complex network measures
Concerning the measures of complex networks, the most important was the CC.CC is a centrality measure defined as the inverse of the average length of the shortest path from one node to all other nodes in the network [105].The idea is that important nodes participate in many shortest paths within a network and, therefore, play an important role in the flow of information in the brain [110].
ALPC was the second important measure associated with the size of the largest community found by the LPC detection algorithm.Increased values (compared to controls) of this metric are associated with the effect of DMT (see figure 7(b)) indicating communities with increased APLs after the use of DMT, in other words, larger communities.The third important metric was the APL which is the average of all shortest paths.For example, the shortest path d ij (also known as the geodesic path) between two nodes i and j is defined as the shortest of all possible paths between these vertices.Increased values for APL were associated with the presence of DMT (figure 7(b)).
In the brain of large vertebrates, there are two contrasting concepts: functional segregation (or specialization) and integration (or distributed processes) [188].Anatomical and functional segregation refers to the existence of specialized neurons and brain areas organized in modules [189], which correspond to communities where their members have high connectivity among themselves and few connections with members of other modules [190].As opposed to segregation, neuron units do not operate in isolation [189]; there are regions of the brain (distributed system of the cerebral cortex) capable of combining specialized information, characterizing the concept of integration [105].These regions have an executing function, benefiting from a high global efficiency of information transfer throughout the entire network [191].The fact that we found larger communities and a longer average path with the use of DMT and the opposite in its absence indicates a decrease in brain integration, which might slow down the distribution of information.Larger brain communities were also found in [45] after using ayahuasca, a mixture containing DMT.
Furthermore, when looking at the transitivity, which is a measure of the propensity of nodes to be grouped, and global efficiency measure, which is a measure of how effective the exchange of information within a network is, both are also presented in the rank of the most important measures for the model in figure 7(b), the presence of DMT decrease the values of these two measures.The transitivity is a measure of the efficiency of information transfer between all pairs of nodes in the graph [192], and a higher value of these measures indicates more significant active local processing and high segregation [193].Since we obtained lower values of transitivity associated with DMT, this implicates less segregation in the brain's functional network.
In contrast, higher values of global efficiency indicate greater integration of networks.Since we obtained lower values of transitivity associated with DMT, this implicates less integration in the brain functional network.
Thus, considering the delta frequency, we can infer that the integration and segregation decreased with the use of the DMT.Furthermore, corroborating our findings, a decrease in brain segregation has been found in studies using other psychedelics such as LSD [194].Specifically, in [194], the authors concluded that the use of LSD caused a decrease in the integration and segregation of brain networks, supporting the idea that cortical brain activity becomes more 'entropic' under psychedelics [195].However, as pointed out in [43], psychedelics not only render the brain more random, but with normal organization disruption, they also produce strong functional and topologically far-reaching connections not seen in the normal state.Thus, even though our results show that integration and segregation have been disrupted, further experiments should be conducted to verify if there have been new long-distance connections, as shown in the literature.

Conclusion and future work
Our results demonstrated that ML methods could automatically reveal changes in functional brain connectivity induced by DMT consumption, considering a two-class classification based on (A) the connectivity matrix or (B) complex network measures.Moreover, considering these two data abstractions is more robust than the other literature studies.
The workflow developed here is powerful for detecting the brain changes caused due to the psychedelic substance, with case (B) showing the highest AUC (89%), indicating a new finding that complex network measurements best capture the brain changes that occur due to DMT use.
Regarding frequency, the workflow employed here detected that the delta frequency was most associated with DMT use.Although DMT induces an altered state of consciousness with the presence of delta, other frequencies were important for recognizing the pattern of brain activity with this substance, such as high alpha and low beta, through the connectivity matrix.This may suggest that the combination of the brain frequencies may represent an important point to be investigated to define further the altered state of consciousness induced by DMT.Furthermore, by using the SHAP value, it is possible to interpret the results of the ML algorithms with a biological interpretation associated with the use of DMT on EEG data.The most important connections found with the use of DMT are between the temporal (TP8) and central cortex (C3) regions, followed by the connection between the precentral gyrus (FC5) and the lateral occipital cortex (P8).
The connection between regions TP8 and C3 has been found in the literature associated with finger movements that might have occurred during DMT consumption.However, the connection between cortical regions FC5 and P8 has not been found in the literature, a new finding, and is presumably related to the volunteers' emotional, visual, sensory, perceptual, and mystical experiences during DMT consumption.
Concerning the measures of complex networks similar to what was found with the use of ayahuasca in [81], the most important is the centrality measure CC.
Furthermore, we find larger communities and a longer average shortest path when DMT is used and the reverse when it is not suggested that the balance between functional segregation and integration has been upset.This suggests that the brain distribution of information using DMT is slower than absence.These findings support that cortical brain activity becomes more entropic under psychedelics.However, from the literature, psychedelics do not simply make the brain more random; after the typical organization is disrupted, strong and topologically far-reaching functional connections emerge that are not present in the normal state.Therefore, since a limitation of our study is that we evaluate the acute effect of this psychedelic, we would like to investigate in the long term how psychedelics change the functional connectivity of the brain using our workflow.Furthermore, although decreased segregation and integration have been found in LSD-related work, this is a new finding for DMT.
Although the results are promising, a limitation of our study is that it is based on only 34 patients at two different times, so in future work, we would like to repeat our methodology in a more extensive dataset.Furthermore, the same methodology applied here may help interpret EEG time series from patients who consumed other psychedelic drugs and can help obtain a detailed understanding of functional changes in the brain neural network due to drug administration.Thus, in future work, we intend to use this methodology on the psychedelic drug called ketamine [196].
Overall, a robust computational workflow has been developed here with interpretability of how DMT (or other psychedelics) modify brain networks and insights into their mechanism of action.

Appendix D. Similarity of results obtained for each frequency
The SHAP value calculated for each frequency band was also considered.For each band, a vector of connection between electrode pairs and its respective SHAP value found by the model is generated.For each of these vectors, the Euclidean distance between them is then calculated, generating a distance matrix of these vectors.This aims to quantify how close the resulting vectors are.The distance matrix is displayed as a cluster map, see figure 9, where vectors with a distance less than 0.2 are connected hierarchically in a dendrogram indicating clusters.Here, the cluster is most prominent between the low beta and the delta frequency band vector.
The same was made for the complex network measure, and then, a cluster map with the Euclidean distance between vectors containing SHAP values for each complex network measure is generated (see figure 10).All vectors, except low beta, are very close to each other.This proximity indicates that the results obtained were similar; in other words, the connections between the electrodes and their respective SHAP value were similar for all frequency bands.Thus, it can be seen that the results of the SHAP value vectors of each frequency, except for the low beta frequency, were very close, showing remarkable similarities between them.

Figure 1 .
Figure 1.Diagram showing the methodology used in the present work.In (A) Data preprocessing, described in the section 3.1, the EEG time series are filtered to remove artifacts (in the picture, the time series of a subject at the time the DMT was used) and then separated into the frequency bands high alpha, low alpha, high beta, mid-range beta, low beta, gamma, delta, and theta (as an example in the picture the topographic map for the frequencies high alpha and high beta for the same subject).For each band, the correlation between the channels is calculated using Pearson's correlation to obtain a 24 × 24 connectivity matrix.In (B) Connectivity matrices, described in the section 3.2, where the connectivity matrices are flattened into a vector that is put into the SVM to verify the most important connections with the use of DMT (in the figure the best performing model, using the high alpha, low beta, and delta bands, found TP8 and C3 as the primary connections).In (C) complex network measures, described in the section 3.3, where the connectivity matrices are analyzed as graphs (in the figure for the same subject, the diagram for the frequencies high alpha and high beta, where the number of connections in each node varies according to the color bar) and from them have extracted measures of complex networks that are applied in the SVM and the best model found for the delta frequency found the closeness centrality (CC) as the main measure.

Figure 2 .
Figure 2. Scalp topography maps generated by ICA analytics were recorded from a subject shortly after inhalation of DMT.The EEG signal was decomposed into twenty principal components.The component with ocular activity (see ICA018 with activity in the frontal region near the eyes) was removed, and an artifact-free EEG signal was reconstructed.

Figure 3 .
Figure 3. ML results using connectivity matrices from high alpha, low beta and delta.Therefore, 210 matrices were used in total, 158 for training and 52 for testing.(a) Confusion matrix for the test sample indicating a true negative rate of 80.8% (purple according to the color bar) and a true positive rate of 84.6% (blue according to the color bar).(b) The learning curve for the training accuracy (blue) and test accuracy (green).(c) ROC curve for the test sample with class 0 (control) and class 1 (after inhalation of DMT).

Figure 4 .
Figure 4. Feature importance ranking for the SVM classifier with electrode correlation (brain regions) ranked in descending order of importance by considering the combination of the best EEG frequency bands (high alpha, low beta, and delta).The connection between the regions TP8 and C3 is the most important to classify the effect of DMT.(a) Feature ranking based on the average of absolute SHAP values over all subjects considering both classes (gray: control, cyan: after inhalation of DMT).(b) Same as (a), but additionally showing details of the impact of each feature on the model.

Figure 5 .
Figure 5. Brain plot displaying these electrode pairs which contributed most to the classification result based on connectivity matrices.The brain plot was made using the Braph tool[165], based on the coordinates in[166,167].

Figure 6 .
Figure 6.ML results using complex network measures for delta frequency filters.Therefore, 70 matrices were used in total, 52 for training and 18 for testing.(a) Confusion matrix for the test sample indicating a true negative rate of 77.8% (purple according to the color bar) and a true positive rate of 100.0%(blue according to the color bar).(b) The learning curve for the training accuracy (blue) and test accuracy (green).(c) ROC curve for the test sample with class 0 (control) and class 1 (after inhalation of DMT).

Figure 7 .
Figure 7. Feature importance ranking for SVM classifier with features ranked in descending order of importance.The CC measure is the most important to classify the effect of DMT.(a) Feature ranking based on the average of absolute SHAP values over all subjects considering both classes (gray: control, cyan: after inhalation of DMT).(b) Same as (a) but additionally showing details of the impact of each feature on the model.

Figure 9 .
Figure 9. Cluster map with the Euclidean distance of each band SHAP value vector.The delta bands and low beta frequencies are the closest frequencies, forming in the cluster map a connection.

Figure 10 .
Figure 10.Cluster map showing the Euclidean distance of the SHAP value vectors for different frequency bands.Frequency band vectors, except low beta, are very close to each other, indicating remarkable similarity.

Figure 11
Figure 11  contains the best measurements of complex networks using the SHAP value method.Further, a Wilcoxon test with Bonferroni correction was also used to compare the measurements before and after DMT, and the following symbols represent the statistical significance:

Figure 11 .
Figure 11.Boxplot showing the best complex network measures.A Wilcoxon test with Bonferroni correction was also used to compare the measurements before (in pink) and after DMT (in purple).

Table 1 .
Performances of the SVM classifier.Complex network measures' classification captures the brain's changes due to DMT slightly better than the connectivity matrix.The best performance is highlighted in bold.