scieee AI-readable full text Open interactive document viewer

A deep graph neural network architecture for modelling spatio-temporal dynamics in resting-state functional MRI data

Azevedo, Tiago,Campbell, Alexander,Romero García, Rafael,Passamonti, Luca,Bethlehem, Richard A. I.,Liò, Pietro,Toschi, Nicola

Abstract

T.A. is funded by the W. D. Armstrong Trust Fund, University of Cambridge, UK. R.A.I.B. is funded by a British Academy Post-Doctoral fellowship and the Autism Research Trust. R.R.G is funded by the Guarantors of Brain. L.P. is funded by the Medical Research Council (MRC) grant (MR/P01271X/1) at the University of Cambridge, UK.

Full text

Medical Image Analysis 79 (2022) 102471 Contents lists available at ScienceDirect Medical Image Analysis journal homepage: www.elsevier.com/locate/media A deep graph neural network architecture for modelling spatio-temporal dynamics in resting-state functional MRI data Tiago Azevedo a , ∗, Alexander Campbell a , Rafael Romero-Garcia b , h , Luca Passamonti c , d , Richard A.I. Bethlehem b , e , Pietro Liòa , Nicola Toschi f , g a Department of Computer Science, University of Cambridge, UK b Brain Mapping Unit, Department of Psychiatry, University of Cambridge, UK c Department of Clinical Neurosciences, University of Cambridge, UK d Istituto di Bioimmagini e Fisiologia Molecolare (IBFM), Consiglio Nazionale delle Ricerche (CNR), Milano, Segrate, Italy e Autism Research Centre, Department of Psychiatry, University of Cambridge, UK f Department of Biomedicine and Prevention, University of Rome “Tor Vergata”, Italy g A . A . Martinos Center for Biomedical Imaging, Massachusetts General Hospital and Harvard Medical School, US h Instituto de Biomedicina de Sevilla (IBiS) HUVR/CSIC/Universidad de Sevilla/ CIBERSAM, Dpto. de Fisiología Médica y Biofísica a r t i c l e i n f o Article history: Received 8 November 2020 Revised 11 April 2022 Accepted 2 May 2022 Available online 7 May 2022 Keywords: Deep learning Graph neural networks UK Biobank Time series Temporal convolutional network Rs-fMRI Spatio-temporal dynamics a b s t r a c t Resting-state functional magnetic resonance imaging (rs-fMRI) has been successfully employed to understand the organisation of the human brain. Typically, the brain is parcellated into regions of interest (ROIs) and modelled as a graph where each ROI represents a node and association measures between ROI-specific blood-oxygen-level-dependent (BOLD) time series are edges. Recently, graph neural networks (GNNs) have seen a surge in popularity due to their success in modelling unstructured relational data. The latest developments with GNNs, however, have not yet been fully exploited for the analysis of rs-fMRI data, particularly with regards to its spatio-temporal dynamics. In this paper, we present a novel deep neural network architecture which combines both GNNs and temporal convolutional networks (TCNs) in order to learn from both the spatial and temporal components of rs-fMRI data in an end-to-end fashion. In particular, this corresponds to intra-feature learning (i.e., learning temporal dynamics with TCNs) as well as inter-feature learning (i.e., leveraging interactions between ROI-wise dynamics with GNNs). We evaluate our model with an ablation study using 35,159 samples from the UK Biobank rs-fMRI database, as well as in the smaller Human Connectome Project (HCP) dataset, both in a unimodal and in a multimodal fashion. We also demonstrate that out architecture contains explainability-related features which easily map to realistic neurobiological insights. We suggest that this model could lay the groundwork for future deep learning architectures focused on leveraging the inherently and inextricably spatio-temporal nature of rs-fMRI data. ©2022 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license ( http://creativecommons.org/licenses/by/4.0/ ) 1. Introduction Resting-state functional magnetic resonance imaging (rs-fMRI) is one of the most commonly used, noninvasive imaging techniques employed to gain insight into human brain function. The use of rs-fMRI data has proven extremely useful as an investigative tool in neuroscience and, to some extent, as a biomarker of brain disease diagnosis and progression ( Fornito et al., 2015 ). Typical use of rs-fMRI data often involves using graph-theoretical mea- ∗Corresponding author. E-mail addresses: tiag[email protected] (T. Azevedo), [email protected] (P. Liò), [email protected] (N. Toschi) . sures (such as centrality measures and community structures) to summarise high-dimensional, whole-brain data for use in downstream tasks. As part of this process, it is common practice to reduce the dimensionality of the data in one of three main ways: (1) by collapsing the temporal dimension (e.g., into connectivity matrices between brain regions), (2) by reducing the spatial dimension (e.g., by aggregating voxelwise signals into predefined brain regions) ( Wang et al., 2019 ), and (3) by employing approaches that collapse both the temporal and spatial dimensions (e.g., in independent component analyses) ( Beckmann et al., 2005 ). These feature engineering steps are performed mostly due to the considerable volume of data in a typical rs-fMRI dataset and its relatively low signal-to-noise ratio ( Smith and Nichols, 2018 ). https://doi.org/10.1016/j.media.2022.102471 1361-8415/© 2022 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license ( http://creativecommons.org/licenses/by/4.0/ ) T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 Although computationally beneficial, such dimensionality reduction steps inevitably involve disregarding large amounts of information which can be useful depending on the analysis task. For instance, collapsing the temporal dimension of rs-fMRI data reduces the brain to a static volume where the interactions between different brain regions are fixed over time. This stands in contrast to a growing body of research which shows that functional connectivity in the brain is dynamic and constantly changes over time ( Avena-Koenigsberger et al., 2017; Liao et al., 2017 ). As another example, association measures most commonly used are still based on linear models, while it is well known that neuromonitoring data and brain signals, in particular, interact nonlinearly ( Duggento et al., 2018; Goelman et al., 2018 ). To overcome such limitations, a different approach to the analysis of rs-fMRI data would be to devise a model that is able to combine both feature engineering and the learning of a lowdimensional representation of the brain’s functional activity. Such a model would need to be able to accommodate both the spatial and temporal complexities of rs-fMRI data. To date, deep learning architectures have had great success at leveraging specific inductive biases from complex high-dimensional data. Convolutional neural networks (CNNs), for instance, are extremely effective at extracting shared spatial features such as corners and edges from grid-like data (e.g., 2D and 3D images). These features can then be combined into more complex concepts deeper within the network architecture ( Spasov et al., 2019 ). Recurrent neural networks (RNNs), on the other hand, are able to learn features from data that are temporally organised as a sequence of steps ( Duggento et al., 2019; Dvornek et al., 2017 ). In contrast to both CNNs and RNNs, graph neural networks (GNNs) can learn from data that do not have a rigid structure like a grid or a sequence, and can be depicted in the form of unordered entities and relations which constitute graphs. The formulation of GNN models that deal with complex data structures has recently seen fast developments ( Zhou et al., 2018; Wu et al., 2019 ) - such models are therefore strong candidates for the analysis of rs-fMRI data. In this work, we propose a model that uses GNNs to account for spatial inter-relationships between brain regions, and temporal convolutional networks (TCNs) to capture the intra-temporal dynamics of blood-oxygenated-level-dependent (BOLD) time series. By incorporating GNNs and CNNs in the same end-to-end architecture, we essentially combine intra- and inter-feature learning. In particular, GNNs can lift the limitation of assuming linearity in the interactions between brain region-specific time series by capturing higher-order interactions between regions of interest (ROIs). We further engineered our architecture to specifically retain edge weights (hence circumventing the common and arbitrary practice of thresholding and binarising adjacency matrices) and to contain elements of explainability ( Arrieta et al., 2020; Samek et al., 2019 ). This was done specifically to provide advantages when a neuroscientific explanation of the inner model workings is desirable. To test our architecture, we use the publicly available UK Biobank dataset, which provides rs-fMRI scans from more than 30,0 0 0 distinct people. This dataset offers a unique opportunity to formulate novel architectures, while supporting the need of large datasets for reproducible findings with minimal statistical errors ( Marek et al., 2020 ). We also conduct an ablation analysis on a proof-of-concept binary sex prediction task to better evaluate the different contributions of each component of our model. Finally, to assess the effectiveness and flexibility of our architecture, we retrain it using the multimodal Human Connectome Project (HCP) dataset in two distinct experiments, one of which contains multimodal neuroimaging data (i.e., rs-fMRI and structural adjacency matrices derived from diffusion-weighted imaging). A very preliminary version of this work, based on a 30-fold smaller dataset, was recently presented as a conference contribution ( Azevedo et al., 2020 ). In this current paper, in addition to employing a significantly larger dataset, we expand the choices in the graph threshold hyperparameter, and analyse the effect of including edge weights. Further, the previous contribution only used 1D-CNNs and a graph convolutional networks (GCNs) with binary graphs, as opposed to a general GNN architecture allowing the inclusion of edge weights. In addition, no explainability analysis was performed in the previous conference paper. We release all the code used to develop this work in a public repository for easier adoption by the community (see “Data and Code Availability” section). 2. Related work Previous work using deep learning for analysing rs-fMRI can be broadly grouped by how the spatial and temporal dimensions are processed. For the vast majority of methods, rs-fMRI is treated as euclidean data arranged on a image grid. A commonly used image representation within this domain is the functional connectivity matrix (FCM): a 2D matrix constructed by using a statistical measure of similarity between ROI-derived time series ( Wang et al., 2014 ). Both multilayer perceptrons (MLPs) and CNNs have been used extensively on FCMs to learn features in order to classify autism spectrum disorder ( Heinsfeld et al., 2017; Eslami et al., 2019 ) and attention deficit hyperactivity disorder ( Riaz et al., 2020 ). A major drawback of using FCMs is that they require an a priori choice of similarity measure, possibly introducing unrealistic bias into the data. For example, the often employed Pearson correlation coefficient can only measure linear associations between BOLD signals. More recently, in line with growing interest in dynamic functional connectivity ( Allen et al., 2014; Preti et al., 2017 ), CNNs have been combined with RNNs to learn from time windowed FCMs for tasks such as fluid intelligence prediction ( Fan et al., 2020 ) as well as identifying major depression ( Yan et al., 2020 ). However, in addition to the choice of similarly measure, the construction of classical, dynamic FCMs requires the selection of a window length, which again is arbitrary and not trivial ( Hutchison et al., 2013 ). An alternative to the FCM representation is to use the entire 4D brain volume timeseries as input to convolutional RNNs ( Bengs et al., 2020; El-Gazzar et al., 2020; Parmar et al., 2020 ). Processing voxelwise fMRI data, however, ignores the empirical evidence that functional brain activity may be localised depending on the task and exhibit very strong spatial correlations ( Sporns, 2011 ). This would result in learning computationally expensive features which likely contain largely redundant information. In line with the view of the human brain as a dynamical functional connectome, more recent deep learning approaches treat rs-fMRI data as a graph. Within this approach, ROIs are commonly employed to represent graph nodes, and edges between nodes are determined by a choice of similarity measure as per FCMs ( Sporns, 2011; 2018 ). In this framework, GNNs can be used to learn features between neighbouring ROIs by propagating information through the edges which connect them. Due to their scalability and interpretability, GNNs for rs-fMRI analysis have been widely used to model tasks such as gender classification ( Arslan et al., 2018; Kim and Ye, 2020; Gadgil et al., 2020 ), age prediction ( Gadgil et al., 2020 ), as well as to find imaging biomarkers for brain disorders such as cognitive impairment ( Wen et al., 2018 ) and autism spectrum disorder ( Li et al., 2020 ). To date, the most common type of graph convolution used for rs-fMRI analysis has been spatial convolutions ( Gadgil et al., 2020; Li et al., 2021 ) although spectral ( Parisot et al., 2017; Ktena et al., 2018 ) and edge convolutions ( Wang et al., 2021 ) have also proven successful for classification tasks. A major limitation of existing works is that graph topology is estimated by taking a group average of FCMs 2 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 ( Kim and Ye, 2020; Wang et al., 2021 ). As a result, connectivity between subjects is assumed to be invariant. Furthermore, the initial choice of features used to represent ROIs is not trivial, ranging from graph theoretic measures to connectivity differences. We address these limitations through our novel combined GNN and CNN model architecture which is capable of learning from individual graph topologies as well as learning its own nodes features. 3. Methods 3.1. Problem definition To represent rs-fMRI data as an undirected weighted graph, the brain is spatially parcellated into Nregions of interest (ROIs) representing graph nodes indexed by the set V = { 1 , ... , N} . Let x i ∈ R T represent the features of node i corresponding to the BOLD time series of length T . The connections between ROIs are represented by an edge set E ⊂V ×Vcomposed of |E| unordered pairs (i, j) , where for every edge k connecting two nodes (i, j) ∈ Ethe connection strength is defined as e k ∈ R . Let the tuple G = (V, E) denote the resulting graph. Given the graph structure G, let X ∈ R N×T , E ∈ R |E|×1 , and A ∈ R N×N denote the nodes features, edge features and adjacency matrix, respectively. 3.2. Temporal convolutional networks There has been evidence that a convolutional operator could perform equally well (or even better) as compared to RNNs for sequential data. Some advantages of the convolutional operator are, for instance: (1) lower requirements for long input sequences, especially compared to LSTMs and GRUs, which commonly consume big chunks of memory to store partial results for the multiple gates (convolutional kernels, in contrast, are shared across a layer), (2) better parallelisation because a TCN/CNN layer is processed as a whole instead of sequentially as in RNNs, and (3) easier to train (e.g., it is known that LSTM training can commonly encounter issues with vanishing gradients). Other teams in industry and academia have found similar results when using convolutional operations for sequential data, for instance, in sequence-to- sequence prediction/learning ( Elbayad et al., 2018; Gehring et al., 2017 ), machine translation ( Kalchbrenner et al., 2016; Kaiser et al., 2018 ), and others ( Chen et al., 2020 ). In summary, there is evidence that although LSTMs have historically been used for sequential data, CNNs can achieve similar or better performance at a significantly lower cost. In order to learn a representation of the temporal dynamics contained in rs-fMRI time series, we use temporal convolutional networks (TCNs) ( Bai et al., 2018 ). These are a simplification over the original WaveNet architecture used for audio synthesis ( van den Oord et al., 2016 ), which has been seen to provide significantly better results for sequence modelling in comparison to more traditional RNN architectures (e.g., LSTMs) across a range of tasks and datasets. In particular, Bai et al. (2018) posit that convolutional networks should be seen as the natural starting point for sequence modelling tasks, which makes them ideal for extracting information from rs-fMRI time series. TCNs are based on dilated causal convolutions ( Yu and Koltun, 2016 ), which are special 1D filters where the size of the receptive field exponentially increases over the temporal dimension of the data as the depth of the network increases. The padding of the convolution is ‘causal’ in the sense that an output at a specific time step is convolved only with elements from earlier time steps from the previous layers, thus preserving temporal order. More formally, given a single ROI time series x i ∈ R T and a filter f ∈ R K , the dilated causal convolution operation of x with f at time tis represented as x i ∗f (t) = K−1  s =0 f (s ) x i (t −d ×s ) , (1) where d = 2 l−1 is the dilation factor which, depending on the layer lcontrols the number of time steps successively skipped. This relation between the dilation factor and the layer lis the one defined in the original paper ( Bai et al., 2018 ), which we follow in this work. In contrast to the original TCN architecture, we use batch normalisation instead of weight normalisation because it empirically provided a more stable training procedure in terms of loss evolution. 3.3. Graph network block Battaglia et al. (2018) formalise a graph network (GN) framework through the definition of functions that work on graphstructured representations. The main unit of computation in the GN framework is called the GN block and contains two update functions and one aggregation function working on the edge and node levels. The first operation of this GN block, which can be broadly defined as the edge model , concerns the update function φe , which computes updated edge attributes for each edge k based on the original edge’s attributes e k and the features of the connected nodes i and j: e  k = φe e k , x i , x j . (2) Note that for rs-fMRI graph representations, each edge originally contains a single value (i.e., e k ∈ R ), but after this operation φe , the resulting dimensionality can be different: e  k ∈ R M , where M > = 1 . Then, in what can be broadly defined as the node model , the block computes updated node features. Firstly, for each node i , it aggregates the edge features per node: e  i = ρe → v E  i , (3) where E  i = { ( e  k , i, j ) } E k =1 is the set of edges starting in node i , with node jconnected with node i through edge k . Importantly, ρe → v needs to be invariant to edge permutations to account for the unordered structure of the data. Averaging and summation are examples of such operations invariant to edge permutations. Finally, the updated node features are computed using another update function at the node level, for each node i : x  i = φv e  i , x i . (4) The aggregation function ρe → v needs to be invariant to edge permutations, but the update functions (i.e., φe and φv ) are more flexible. For example, if the features are vectors in 1D space, the update functions could be implemented as multi-layer perceptrons (MLPs); however, a CNN or RNN could be more suitable if the features represent images or sequences, respectively. Section 4.2 details how these functions were implemented in this paper. Although the rs-fMRI graph representation contains undirected edges, the GN block requires directed edges. To overcome this issue, every time there is a connection between any two nodes i and j, we assume the existence of two edges ( e k , i, j) and ( e k , j, i ) , one for each direction. The original GN block ( Battaglia et al., 2018 ) further contains one update function and two aggregation functions for global (i.e., graph-level) features; however, we do not use this formalisation as it is not applicable in the fMRI data representation of this paper. 3.4. Graph pooling After the neural network processes the input as described in the previous sections, each node in the graph will contain a node-wise 3 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 representation (i.e., a feature vector) as a result. For the prediction task described in this paper, where a graph-level (as opposed to node-level) prediction is required, these representations need to be pooled (i.e., collated) to be used for a final downstream prediction task. To this end, it is common practice to employ a global pooling mechanism, in which node features are pooled across the graph (e.g., by averaging or concatenating all node features), thus creating a final, low-dimensional embedding representation of the graph itself. Given the graphs used in this paper all have the same number of nodes, a concatenation pooling mechanism is indeed possible. However, assuming that distinct nodes (i.e., brain regions in this paper) have different levels of importance for the downstream prediction task ( Kiebel et al., 2008; Hilgetag and Goulas, 2020 ), we assumed that a hierarchical (as opposed to flat) pooling mechanism would create richer embeddings. To this end, we employ the differentiable pooling operator introduced by Ying et al. (2018) , commonly called DiffPool, which learns how to sequentially collapse nodes into smaller clusters until only a single node with the final embedding exists. When describing a Graph Network (GN) block, a sparse representation of nodes and edges is used to describe the operations that a GN block can have; however, DiffPool works on dense representations of a graph. In other words, a graph Gis represented by a dense adjacency matrix A ∈ R N×N and a feature matrix X ∈ R N×F , where Nis the number of nodes and F the number of features in each node. The DiffPool operator, at layer l, thus receives both an adjacency matrix and a node embedding matrix, and computes updated versions of both: A (l+1) , X (l+1) = DiffPool A (l) , X (l) . (5) To achieve this, the DiffPool operator uses a graph neural network (GNN) architecture. Specifically, the same GNN architecture is duplicated to compute two distinct representations: a new embedding Z ∈ R N (l) ×F  and an assignment matrix S ∈ R N (l) ×N (l+1) : Z (l) = GNN l, embed A (l) , X (l) (6) S (l) = softmax GNN l, pool A (l) , X (l) , (7) where N (l) is the number of nodes in layer l, N (l+1) the new number of nodes, each corresponding to a cluster ( N (l+1) < N (l) ), and F  the number of features per node, which can be different from the original size F from the matrix X . The operator ends with the creation of the new node embedding matrix and adjacency matrix, to be inputted to the next layer: X (l+1) = S (l) T Z (l) (8) A (l+1) = S (l) T A (l) S (l) , (9) where X (l+1) ∈ R N (l+1) ×F  and A (l+1) ∈ R N (l+1) ×N (l+1) . Overall, Eqs. (6) –(9) are the ones responsible to implement Eq. (5) . 4. Experiments overview 4.1. Main dataset - UK biobank Subject-level structural T1 and T2-FLAIR data as well as ICAFIX ( Salimi-Khorshidi et al., 2014 ) denoised rs-fMRI data were obtained from UK BioBank (application 20904) ( Bycroft et al., 2018 ) 1 . 1 https://biobank.ctsu.ox.ac.uk/crystal/crystal/docs/brain _ mri.pdf All data were acquired on a standard Siemens Skyra 3T scanner running VD13A SP4, with a standard Siemens 32-channel RF receive head coil. The structural data were further preprocessed with Freesurfer (v6.0) 2 using the T2-FLAIR weighted image to improve pial surface reconstruction, similarly to Glasser et al. (2013) ’s pipeline. Reconstruction included bias field correction, registration to stereotaxic space, intensity normalisation, skull stripping, and white matter segmentation. When no T2-FLAIR data were available, Freesurfer reconstruction was done using the T1 weighted image only. Following surface reconstruction, the Desikan-Killiany atlas ( Desikan et al., 2006 ) was aligned to each individual structural image, and ROIs were mapped into each individual’s space for subsequent time series extraction. To this end, the same atlas was aligned to the functional denoised rs-fMRI data (490 volumes TR/TE = 735/39.00 ms, multiband factor 8, voxel size: 2.4 ×2.4 ×2.4, FA = 52 deg, FOV 210x210 mm) using the warping parameters computed during the structural-to-functional alignment obtained using FSL’s linear registration (FLIRT), and mean BOLD time series (490 timepoints per scan) were extracted for each ROI. The time series were then scaled subject-wise using the median and interquartile range according to the RobustScaler implementation in the scikit-learn ( Pedregosa et al., 2011 ) python package. Edge weights were defined as full correlations calculated with the Ledoit Wolf covariate estimator using the nilearn python package 3 . Figure 1 shows an example scaled time series and the resulting example graph from a single subject. The total number of subjects used from the UK Biobank was 35,159, in which 18,649 were females and 16,510 were males ( 18 , 649 / 16 , 510 ≈1 . 13 ). The median age was 64, with a minimum age of 44 and a maximum of 81. 4.2. Model implementation The neural network architecture depicted in Fig. 2 was implemented using Pytorch ( Paszke et al., 2019 ), and Pytorch Geometric ( Fey and Lenssen, 2019 ) for the specific graph neural network components. The edge feature matrix E ∈ R E×1 defined in Section 3.1 was implemented as two sparse matrices: a sparse representation of the adjacency matrix E i ∈ R 2 ×E , and a sparse representation of the edge features E a ∈ R E×1 (i.e., there was only one feature per edge corresponding to the correlation value). The number of nodes Nwas 68 (corresponding to each brain region from the Desikan-Killiany atlas), the number of node features F was the number of timepoints (i.e., 490), and Eis the number of edges in the graph. The number of edges depends on the threshold percentage used to retain only the strongest correlations. Given the nonconclusive evidence on the optimal threshold percentage in the vast majority of functional connectivity literature ( Garrison et al., 2015 ), in this work this threshold was included in the hyperparameters to be optimised. The full list of hyperparameters and respective value ranges were as follows: •dropout : [ 0 , 0 . 5 ] (uniform distribution) •threshold : { 5 , 10 , 20 , 30 , 40 } (categorical) •learning rate : [ 1e −5 , 1e −1 ] (log uniform distribution) •weight decay : [ 1e −12 , 1e −1 ] (log uniform distribution) The model starts by employing a temporal convolutional network (TCN) architecture ( Bai et al., 2018 ) to extract a lowerdimensional embedding representation from the rs-fMRI time series in each node. This was implemented by using three blocks, 2 http://surfer.nmr.mgh.harvard.edu/ 3 https://nilearn.github.io/ 4 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 Fig. 1. Left: Mean BOLD time series extracted from four brain regions (see legend) from one subject’s data, after scaling. Right: Graph representation of the same subject’s data, at 10% threshold as described in Section 4.2 . Thicker edges represent a stronger correlation between nodes, in this case with values between approximately 0.54 and 0.87. Each node is labelled and coloured according to the brain region it represents (i.e., T/F/O/P/I correspond to T emporal, F rontal, O ccipital, P arietal, and I nsula). Fig. 2. Main working blocks of the spatio-temporal model. The temporal model creates an initial representation from the original node features X (i.e., temporal dynamics). This is followed by transformations operated by the Graph Network Block which leverages the structure of data represented in edge features E a and its sparse connectivity E i . Finally, a Pooling mechanism (either DiffPool or concatenation) creates a graph representation which is flattened and employed for a final prediction task. each of which containing two layers of 1D convolutions, 1D batch normalisation, ReLU activation , and dropout . Each block uses a kernel with size 7 (i.e., K = 7 in Eq. (1) ), containing a skip connection, and increases the number of output channels at each block, specifically 8, 16, and 32. Dilation factor dwas set to d = 2 l−1 , where lis the block (i.e. l ∈ { 1 , 2 , 3 } ). After these three blocks (i.e., six layers), node features from all channels are flattened to form the input to a linear transformation which reduces each node representation to a fixed embedding of size 16. These transformations thus reduce the original node feature matrix from size N ×T to size N ×32 ×T after the three blocks, and finally to size N ×16 , corresponding to the final embedding. The Graph Network (GN) block is then applied, in which the update functions φe and φv in Eqs. (2) and (4) are multi-layer perceptrons (MLPs), and the function ρe → v in Eq. (3) is a set of aggregators following Corso et al. (2020) ’s work (i.e., edge-wise mean, min, max, standard deviation, and sum). We stack 3 GN blocks, after each of which we apply an 1D batch normalisation over the node’s features and a ReLU activation . The original dimensions of X , E i , and E a before the GN block are kept after these transformations. We employed two types of pooling mechanisms, both of which reduce the node feature matrix from a size of N ×16 to a size of 1 ×16 : a concatenation over all node’s features followed by a single-layered MLP, and the hierarchical pooling mechanism (i.e., DiffPool). For DiffPool, which expects a dense graph representation, data are first transformed into a symmetric adjacency matrix A ∈ R N×N , which is a weighted matrix when considering edge features, and binary otherwise. Similarly to the original DiffPool paper ( Ying et al., 2018 ), we employed three layers of the graph neural network operator from Morris et al. (2019) (to make use of weighted adjacency matrices) followed by a 1D batch normalisation , with a final skip connection. We empirically evaluated various architectural choices on a single training fold of the dataset, and how they influenced performance on the corresponding validation fold. This ad-hoc evaluation showed that a higher number of TCN layers and overall model complexity slightly improves performance. However, given that some of these parameter choices (e.g. with 4 TCN blocks) produced a significantly higher number of learnable parameters and prohibitive GPU memory constrains, effectively inhibiting experimentation, the final TCN architecture was chosen as described in this section (with 3 TCN blocks and a final embedding size of 16). A conceptual summary of the whole model is shown in Fig. 2 . 4.3. Training procedure In order to assess the validity of our model, we performed proof-of-concept experiments through the well-known binary sex prediction task ( Jiang et al., 2019; Weis et al., 2019 ). We used a 5- fold stratified cross-validation procedure: the UK Biobank dataset was divided into training and test sets five times, in which each test set corresponds to 20% of the original size, and a sample would only belong to a test set once (i.e., all test sets are mutually 5 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 Fig. 3. Values of hyperparameters corresponding to each validation loss achieved for one illustrative inner sweep of one fold. For each one of the 25 training runs (each represented by a curved line), a set of random values is chosen for dropout, learning rate, edge threshold and weight decay, which ultimately results in the model’s validation loss. exclusive). This division was done in a stratified fashion considering the sex label, bucketised age, and bucketised BMI measures (for each variable we created 8 equal-sized buckets based on sample quantiles). For each test set, the training set is further divided once to generate single inner training and validation sets, using the same stratification strategy as for the training/test case. The neural network was trained over 150 epochs with the RM- Sprop optimiser ( Tieleman et al., 2012 ) and Binary Cross-Entropy loss function. The training procedure was set to stop early if the validation loss did not reduce further after 33 consecutive epochs. Learning rate is reduced by a factor of 0.1 with patience of 30. A hyperparameter search was included in the inner training/validation sets, in which 25 random runs were launched exploring random values of dropout, edge threshold, learning rate, and weight decay (see Section 4.2 for ranges explored). In each random run, the model with the smallest validation loss was saved, and the model with the smallest validation loss across the 25 runs was selected to be evaluated in the test set. This procedure is done separately for each test set, and metrics are then averaged across the five test sets. We used Weights & Biases Biewald (2020) to log our training procedure and generate the random hyperparameters for all the 25 models in each inner sweep. These inner sweeps were run across two different servers, and each model took between 20 min and 11 h to train depending on GPU type and early stopping. All these details are stored using Weights & Biases , and can be accessed through our public repository (see “Data and Code Availability”). Figure 3 shows the results for the inner sweep of one of the folds for illustrative purposes. While a certain amount of variability is visible, some trends are evident in this particular split: the best models (i.e., with lower validation loss) tend to be achieved with higher edge thresholds, higher learning rates, and lower dropout rates. We highlight that different sweeps could result in different trends. 4.4. Evaluation As shown in Fig. 2 , our model consists of (1) a TCN block that learns intra-temporal features from the mean BOLD time series of each ROI, followed by (2) a GN block which leverages the spatial inter-relationships between ROIs, and finally (3) a hierarchical pooling mechanism which leverages all the information in the input, from the temporal rs-fMRI dynamics to the graph structure and the edge features of that graph. To understand the inner workings of this combination, we conducted an ablation analysis to quantify the contributions of each component of our model for the specific prediction task. Firstly, we consider two cases where the GN block is not used, hence essentially evaluating the importance of edge weights for this prediction task. In one case the graph structure is completely ignored (i.e., no GN block and concatenation pooling), and in another case a binary graph is used only for the final hierarchical pooling part (i.e., no GN block and DiffPool applied to a binary graph). In order to investigate the influence of the different GN components, we consider not only the case where both node model and edge model are used in the GN Block, but also a case where only the node model is applied. For each of these two cases, both a concatenation pooling and DiffPool with weighted adjacency matrices are considered. We compare our approach to two deep learning models. The first one, by Gadgil et al. (2020) (which we named CNSLAB) is based on a voting scheme across timesteps, and the second, by Wang et al. (2021) , named cGCN, uses averaged FCMs. For both we used the best hyperparameters selected from each paper/repository and trained those models on our preprocessed data. We also compare our approach to baseline models where data structure is not leveraged; here, the entire data representation is flattened and fed into two non-deep learning models. To this end, we employed: (1) a support vector machine (SVM) classifier with a linear kernel and hyperparameter search over the regularisation parameter, and (2) a XGBoost ( Chen and Guestrin, 2016 ) classifier with hyperparameter search over several parameters. 4.5. External multimodal dataset - human connectome project To further evaluate the effectiveness and flexibility of our end- to-end architecture, we analysed its behaviour in a multimodal setting, i.e. when adjacency matrices and timeseries are derived from distinct imaging procedures (fMRI and diffusion-weighted MRI, respectively). We employed the preprocessed Human Connectome Project (HCP) fMRI Data. This dataset consists of four 15-minute- long fMRI sessions (TR = 0.72s) per subject, acquired on a 3T scanner with isotropic spatial resolution of 2mm in 1003 healthy subjects, and preprocessed according to Glasser et al. (2013) . For each subject, this results in 4 distinct sessions/samples per sub- 6 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 Table 1 Ablation analysis, with metrics averaged across the five test sets, with standard deviation in parenthesis. Aggregator on the right-hand side of the arrow, “N” corresponds to only node model , and “N + E” corresponds to full Graph Network block. Params stands for number of parameters. Model AUC Accuracy Sensitivity Specificity Params N + E → Concat 0.92 (0.004) 0.85 (0.006) 0.85 (0.006) 0.84 (0.012) 291,898 N + E → DiffPool 0.82 (0.020) 0.75 (0.016) 0.72 (0.030) 0.77 (0.025) 287,420 N → Concat 0.92 (0.003) 0.84 (0.004) 0.84 (0.028) 0.85 (0.029) 291,337 N → DiffPool 0.84 (0.020) 0.76 (0.020) 0.75 (0.013) 0.77 (0.038) 286,859 → DiffPool 0.84 (0.010) 0.76 (0.008) 0.75 (0.019) 0.77 (0.023) 278,843 → Concat 0.92 (0.012) 0.84 (0.013) 0.84 (0.024) 0.84 (0.023) 283,321 CNSLAB ( Gadgil et al., 2020 ) 0.86 (0.003) 0.78 (0.005) 0.76 (0.024) 0.79 (0.018) 198,937 cGCN ( Wang et al., 2021 ) 0.77 (0.021) 0.70 (0.018) 0.66 (0.028) 0.74 (0.040) 45,065 XGBoost 0.89 (0.003) 0.81 (0.005) 0.80 (0.008) 0.82 (0.006) - SVM 0.79 (0.015) 0.79 (0.017) 0.82 (0.098) 0.76 (0.101) - ject with 1200 timesteps for each sample and component. In order to ensure comparability to the UK Biobank experiments, every timeseries was truncated to 490 timepoints. Similarly to the steps described in Section 4.1 , the Desikan-Killiany atlas ( Desikan et al., 2006 ) was aligned to each individual structural image, warped into single subject space, and employed to extract ROI- and subject-wise timeseries which were scaled subject-wise. Diffusion data was processed locally using multi-tissue, multishell constrained spherical deconvolution ( Jeurissen et al., 2014 ) to obtain orientation distribution function estimates, which were then passed to probabilistic fiber tracking (10 8 tracks, subsampled to 10 7 tracks through Spherical-deconvolution Informed Filtering of Tractograms Smith et al., 2013 ). Structural connectivity matrices were obtained by length-normalised streamline counts between the same ROIs described above. A total of 3668 graphs were used (1692 males and 1976 females), where nodes correspond to Desikan-Killiany ROIs, node features correspond to 490 time points, and the adjacency matrix corresponds to the structural connectivity extracted from probabilistic tractography. All training and evaluation steps were kept identical across all datasets. 5. Results 5.1. General results Table 1 shows the results of our ablation analysis across three different backbones - no graph block, only node model , and full graph network block - each with two different aggregators (i.e., concatenation and DiffPool). We identify each one of these cases using a “Backbone → Aggregator” notation, in which Aggregator can be “Concatenation” or “DiffPool”, and Backbone can be “N” for only node model , “N + E” for both node model and edge model (i.e., full GN Block), and empty otherwise. We also include results from the baselines experiments. Our model performs significantly better as compared to all baselines but in which the model without a GNN block (i.e., “→ Concat’) is similarly good. The SVM baseline performs worse overall and involves an increase in the standard deviation of performance parameters, possibly indicating that our model is more robust to different dataset divisions (i.e., folds), while retaining the flexibility and representation ability described above. Using Diff- Pool as a final aggregator appears to result in worse overall performance when compared to the concatenation counterpart and, in some metrics, to some baselines. Using the edge model did not bring significantly better results when compared to using the node model only, possibly indicating that the information contained in the edge attributes is successfully leveraged by the node model alone for this particular prediction task. The results presented so far consider an adjacency matrix threshold below 50% as a hyperparameter at training time, a common data reduction practice in the connectivity analysis field. We further analysed the results of using no threshold at all, and explored the type of activation function as a hyperparameter instead (i.e., ReLU or tanh activations). This choice was made explicitly since retaining 100% of the adjacency matrix elements results in a share of negative correlation elements, whose physiological significance is likely to be important in brain connectivity ( Zhan et al., 2017 ). The results of this analysis are presented in Table 2 . The performance was slightly lower for most cases which did not include a threshold, especially for the N + E → DiffPool model. A possible explanation would be the excessive “noise” (i.e., low, possibly spurious correlations) not allowing the graph’s dominating spatial structure to be successfully leveraged in a practical timeframe, in turn possibly resulting in some degree of overfitting. However, performance metrics remain comparable or better to what is illustrated in Table 1 , suggesting that these models are still able to extract spatial information from the data after training despite of the significant increase in memory usage. 5.2. Evaluating architectural choices To better understand the utility of TCNs when compared to the more traditional LSTMs, we reran six ablations using the UK Biobank dataset, in which we substituted the TCN block with a LSTM block. Striving for a fair comparison between LSTM and TCN, we used the same number of layers in both (i.e., three layers), and chose the feature dimension in the hidden state such that the total number of learnable parameters would be similar. We made sure that the 25 runs per fold would have the same hyperparameter ranges in both the TCN and LSTM cases. Table 3 shows that the LSTM models achieve similar performance to the TCN models; however, this comes at a significantly higher computational cost. Due to computational constraints, we are not able to fairly compare the runtimes among all models because of the use of different servers with different GPU cards (see Section “Acknowledgements”). However, for representation purposes, there are two folds in the “N → DiffPool” model (i.e., folds 4 and 5) which were run in the same GPU for both the TCN and LSTM cases; in this case, the average runtime per model training went from 1 h and 35 min (fold 4) and 1 h and 38 min (fold 5) in the TCN case, to an average of 3 h and 14 min (fold 4) and 2 h and 47 min (fold 5) in the case of the LSTM. Given that these experiments were run on the most recent NVIDIA A100 GPUs, which are able to speedup runtimes by a large factor when compared to older GPUs, we expect these differences to be more striking when running the models on more commonly used hardware. 7 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 Table 2 Results with no thresholded graphs, with metrics averaged across the five test sets, with standard deviation in parenthesis. Aggregator on the right-hand side of the arrow, “N” corresponds to only node model , and “N + E” corresponds to full Graph Network block. Model AUC Accuracy Sensitivity Specificity N + E → Concat 0.92 (0.002) 0.84 (0.004) 0.85 (0.014) 0.83 (0.017) N + E → DiffPool 0.77 (0.012) 0.70 (0.011) 0.68 (0.080) 0.72 (0.067) N → Concat 0.93 (0.003) 0.85 (0.003) 0.83 (0.017) 0.86 (0.019) N → DiffPool 0.85 (0.007) 0.77 (0.008) 0.77 (0.026) 0.77 (0.017) Table 3 Results when using an LSTM instead of a TCN in the temporal block (UK Biobank fMRI dataset). Model AUC Accuracy Sensitivity Specificity N + E → Concat 0.93 (0.002) 0.85 (0.004) 0.85 (0.006) 0.85 (0.005) N + E → DiffPool 0.84 (0.014) 0.76 (0.015) 0.74 (0.051) 0.77 (0.031) N → Concat 0.93 (0.004) 0.85 (0.007) 0.85 (0.020) 0.86 (0.019) N → DiffPool 0.84 (0.020) 0.76 (0.017) 0.78 (0.025) 0.74 (0.035) → DiffPool 0.82 (0.035) 0.73 (0.034) 0.73 (0.083) 0.74 (0.090) → Concat 0.91 (0.003) 0.83 (0.003) 0.82 (0.020) 0.83 (0.012) Table 4 Results when no TCN block is used to train and evaluate on the UK Biobank dataset. Model AUC Accuracy Sensitivity Specificity Params (Before) N → Concat 0.93 (0.004) 0.85 (0.004) 0.85 (0.014) 0.86 (0.013) 23,541,071 (291,337) N + E → Concat 0.93 (0.002) 0.85 (0.003) 0.84 (0.017) 0.86 (0.015) 24,022,742 (291,898) In summary, our experiments confirm findings that RNNs and CNNs can provide similar performance, but the former come with a significantly higher computational cost. We further evaluated the impact of including the TCN block in the model. In this “no TCN” experiment, we omitted the TCN block and therefore only the GNN components are present, with a much larger temporal feature representation (i.e., 490 raw timepoints instead of the 16 features created by the TCN block). Table 4 shows that performance metrics were similar between the TCN and no TCN versions, but the latter resulted in an almost 100-fold increase in the number of parameters. This means that removing the TCN block came at a very significant cost of an unnecessary explosion in the number of learnable parameters, making the model unnecessarily complex both at training and test time. The important task of finding a good representation in machine learning goes therefore beyond the simple performance analysis (i.e., metrics), and by using a TCN block we are able to find a lower embedding in a realistic time/complexity frame. 5.3. Visualisation of TCN kernels The weights of the TCN layers can be visually inspected. We visualised the first two layers of one of the trained N + E → Concat models. Fig. 4 shows the weights learned from the first TCN layer (each row corresponding to one of the 8 output channels of that layer), while Fig. 5 depicts the same for the second TCN layer (each row corresponding to one of the 8 output channels and the columns corresponding to the 8 kernels of size 7 coming from the previous 8 channels). In both figures, and with little exceptions, it can be seen that the output channels in the first two TCN convolutional layers will be a non-trivial weighted multiplication of input channels, as illustrated by the non-trivial patterns in the kernel weights. Given the qualitative variability observed in these weights (which are learned at training time), we argue that these kernels are likely filtering and selecting different, non-mutually redundant patterns present in the original time series. One possible counterexample is the kernel for the 7th output channel in the first TCN convolutional layer illustrated in Fig. 4 , which is essentially applying a simple low pass filter by smoothing the original time series from the input chan- Fig. 4. Weights of the kernels in the first TCN convolutional layer in a N + E → Concat model. Rows correspond to the 8 output channels of this layer, and each column is a position in the kernel array of size 7. nel. It is likely that quantitative analysis and comparison of the kernel weights has the potential to yield interpretable information on which type of brain dynamics may contribute most to the final prediction. Given that these weights are also influenced by additional factors such as normalisation strategy and subsequent nonlinear operations, further research is needed in order to establish a framework to fully exploit this information. 5.4. Explainability of DiffPool clusters Although deep neural networks are usually regarded as “black boxes”, in this paper we strived to inject explainability elements by inspecting which mechanisms were learned during training. To this end, we designed a strategy to inspect the hierarchical spatial pooling mechanism provided by the DiffPool architecture. We analysed the assignment matrices from the first DiffPool layer S (1) 8 T. Azevedo, A. Campbell, R. Romero-Garcia et al. Medical Image Analysis 79 (2022) 102471 Fig. 5. Weights of the kernels in the second TCN convolutional layer in a N + E → Concat model. Rows correspond to the 8 output channels of this layer, and each column is a position in the 8 kernels of size 7 that come from the 8 input channels (56 columns in total). (see Eq. (7) ), over all participants across all test sets. This is of particular interest because it corresponds to an aggregation of subsets of brain regions which our architecture has considered optimal while learning a particular prediction task. These aggregations can therefore be considered “optimal” for that task within this architecture, and provide insight into the neurophysiology which may drive the formation of such patterns. An assignment matrix corresponds to how the original nodes in the graph will be mapped into new nodes. In this respect, a simple and useful way of summarising this behaviour across individuals is to count how many times two ROIs have ended up in the same cluster, regardless of cluster size and number. More formally, we create an association matrix S  ∈ R 68 ×68 , where each element S  i,j is the number of times brain regions i and jhave been assigned together in the first DiffPool layer. This means that the higher the value of S  i,j , the more often information from brain regions i and jis pooled when learning to predict binary sex. It is important to note that matrix thresholding (see threshold hyperparameter in Section 4.2 ) can - and often will - introduce disconnected nodes in the graph. Since the number of disconnected nodes would vary across individuals, this would introduce unrealistic imbalances/biases in the association matrix S  ; therefore, in this section, we only employed unthresholded matrices. In specific, we used the best performing DiffPool model (i.e., N → DiffPool) described in Section 4.2 . Figure 6 depicts the association matrix S  for the best performing DiffPool model (i.e., N → DiffPool) trained on unthresholded matrices, with dendrograms resulting from hierarchical clustering of this latter matrix (performed for visualisation purposes). The hierarchical clustering algorithm and the corresponding dendrograms are calculated using the seaborn ( Waskom, 2021 ) python package. In addition, we generated a more traditional brain connectivity visualisation by selecting the four main clusters defined by the dendrograms for the N → DiffPool model and overlaying their anatomical correspondence on a sample brain surface in Fig. 7 . An advantage of this explainability strategy (i.e., the use of the association matrix S  ) is the flexibility inherent in the multiple granularities provided by hierarchical clustering. When choosing large clusters (e.g., four like in Fig. 7 ) one can illustrate the general aggregation patterns across the brain’s anatomy, while by selecting smaller clusters (e.g. twelve clusters) one can reveal more local patterns in the data. In Fig. 8 we depict the brain clusters for the N → DiffPool model with the remaining different granularities (i.e., 8 and 12). This multiscale explainability framework can provide a significant advantage in terms of explainability and interpretation, and is only possible when using the DiffPool strategy. When looking at how the GNNs clustered the brain regions to optimise and achieve best sex prediction, it is possible to find that clustering into four sets of brain regions showed interesting properties in terms of neurobiological explainability. More specifically, the brain regions were grouped in a manner that mirrors to a certain degree the well-known cytoarchitectural and functional properties of the cerebral cortex. For example, in Fig. 7 cluster 1 (dark blue) included the bilateral frontal cortex as well as occipitoparietal regions that have a well-known role in working-memory, executive functions, and visuo-spatial processing, amongst many other cognitive functions. The left temporal cortex grouped with the paracentral lobule, while the right temporal cortex clustered with the pre-cuneus (light green and light blue, respectively). Cluster 3 (dark green) included several midline cortical areas that form the classic limbic-emotional system. We do not wish to overinterpret our results or make “reverse neuroscience” inferences in the sense of interpreting post hoc the behavioural meaning of a set of regions without having directly analysed their behavioural relevance. However, we speculatively note that the clusters emerged may have some neurobiological relevance in terms of explaining some of the behavioural differences described between males and females in terms of cognitive, motor and emotional skills ( Nieuwenhuys et al., 2008; Poeppel et al., 2020 ). Future work, particularly directed at investigating the links between brain and behavioural measures, is warranted to confirm whether the clustering of regions that our model has generated to achieve optimal sex classification is relevant at phenotypical level. In summary, these results demonstrate the explainability capacity of our model when using the DiffPool aggregator. To evaluate the robustness of the DiffPool clusters, we compared the association matrices S  for all the five folds for the best performing DiffPool model (i.e., “N → DiffPool”) trained on the unthresholded matrices (see Fig. 9 ). Despite some differences, it is possible to see a similar overall qualitative structure across the folds. To quantify this difference in a simple way, we calculated the normalised difference between every pair of association matrices i and jas: Normalised difference = S  i −S  j S  i + S  j . (10) The various normalised differences can be seen in Fig. 10 , with every pair showing an average normalised different below 30%, therefore demonstrating an acceptable stability and robustness of the clusters learned by DiffPool across folds. 5.5. Evaluation on an external multimodal dataset Table 5 shows the results when training and evaluating our architecture on the Human Connectome Project (HCP) dataset, both for the multimodal (rs-fMRI and diffusion data) and unimodal (only rs-fMRI data) cases. Performance metrics of our model are lower, as compared to the UK Biobank analyses, when considering only rs-fMRI data (i.e., 3–5% difference for concatenation and around 20% difference when using DiffPool). This may illustrate known concerns about the behaviours of deep learning models in general, and graph learning models in particular, when data is scarce; indeed, in the case of rs-fMRI data only, the non-DL baselines reach similar, or slightly better performances when compared to all DL models (both our model and the DL baselines), confirming that DL models can struggle with smaller datasets. However, in the multimodal case, when complementary information from both rsfMRI (i.e. functional data) and diffusion-weighted MRI (i.e. structural data) are used, our model performs notably better than all baselines. This highlights how our model can flexibly leverage multiple data sources, achieving performances that in some cases are higher than the unimodal results obtained with the much larger UK Biobank dataset. This also emphasises the anticipated outcome 9