## 3 Materials and Methods
### Feature Extraction  
Dynamic functional connectivity:  
Functional-connectivity estimation can be static and dynamic. The static functional-connectivity metrics assume that the degree of connectivity remains constant throughout the trial. Therefore, these metrics can only estimate the average degree of connectivity over the trial. Many static functional-connectivity methods are proposed in the literature, such as the phase locking value (PLV) [29], Pearson correlation [30], and the weighted phase lag index (wPLI) [31]. While all these methods focus on static functional connectivity, they differ in their approach to bypass volume conduction [24]. However, static approaches fail to detect the intervals during which brain regions are functionally connected or disconnected [15]. Therefore, there is a need to find additional information when these changes occur, and hence, the researchers have introduced a dynamic functional-connectivity approach. The adaptive sliding window is computed using the relative intersection of the confidence interval rule (RICI) algorithm proposed in [15].  
Bayesian Score:  
Given a Bayesian network represented as a directed acyclic graph (DAG), the observed data-to-score nodes were utilized in this network to ascertain their fit and appropriateness. This scoring method is especially essential when discerning the optimal structure for the Bayesian Network considering the data.  
Figure 2: (a) 10–20 system of EEG placement (b) Experimental paradigm.  
Observed Data:  
Let G = (V,E) be a DAG representing a set of random variables X1, X2,\(\ldots\), Xn. The observed dataset is given by [32]:  
\[D=\left\{D_{1},D_{2},\ldots D_{m}\right\} \tag{11}\]  
where  
\[D_{i}=\left\{x_{1}^{i},x_{2}^{i},\ldots,x_{m}^{i}\right\} \tag{12}\]  
each is a vector comprising n observed values for each variable in the network, linked to the ith data point.  
Bayesian Scoring:  
The Bayesian score of the network structure G, given the observed data D, is:  
\[\text{score}(G|D)=p(D|G)p(G) \tag{13}\]  
where \(p(D|G)\) is the likelihood of the data given the network structure, \(p(G)\), and is the prior probability of the network structure.  
Node Score:  
For a particular node i in the network, the score, termed score(i), is defined as [33]:  
\[\text{score}(i)=\log\Gamma(\sum_{P}\alpha_{P})-\sum_{P}\log\Gamma(\alpha_{P})+ \sum_{P}\log\Gamma(\alpha_{P}+m_{i},P)-\log\Gamma(\sum_{P}(\alpha_{P}+m_{i},P)) \tag{14}\]  
where:  
* \(\Gamma\) represents the gamma function.
* \(\alpha_{P}\) denotes the hyperparameter tied to the ith configuration of the parent nodes for node i as per a Dirichlet prior [34].
* \(m_{i},P\) symbolizes the observed count of the concurrent occurrence of node i and its pth parent configuration within the data.
* The node score quantifies both: \(\odot\) The alignment of the node with the observed data (captured by the multinomial likelihood). \(\odot\) The prior convictions about the distribution of the node's values are conditional on its parents (expressed via the Dirichlet prior).  
Bayesian-Structure Learning Algorithm:  
Different Bayesian-structure learning algorithms, which can be broadly classified into score-based, constraint-based, and hybrid algorithms, are proposed in the literature. The score-based algorithms use a goodness-of-fit score that learns the data structure by iteratively maximizing the score, whereas constraint-based algorithms learn the dependence structure of data using conditional independence tests. The hybrid algorithms combine both methods. Of these algorithms, score-based methods are fast and produce efficient results. These algorithms include local search, genetic algorithms, simulated annealing, and greedy search; a thorough review is provided in [32]. This paper uses the local search algorithm to estimate the functional connectivity of EEG signals in the sensor space. The step-by-step procedure of the Bayesian-structure learning algorithm is presented in Algorithm 1.