# Dynamic Ensemble Selection for EEG Signal Classification in Distributed Data Environments
## 2 Materials and Methods  
In the context of EEG analysis, especially when handling data from multiple sources or collection sites, it is common to encounter dispersed data--datasets that differ in structure, either due to variations in feature representation or the distribution of examples. To address this, and to support privacy-preserving processing, we adopt a local modeling strategy, where models are trained independently on isolated subsets of the data, referred to as local tables. These subsets are processed without requiring global data access, allowing for modular and decentralized analysis. Different machine learning classifiers could be used for the local table. In this study, to analyze and model localized segments of EEG signals, we systematically compare five widely recognized algorithms: Random Forest, AdaBoost, Gradient Boosting, k-Nearest Neighbours, and Logistic Regression. Each classifier is trained separately on a distinct local dataset, with each dataset comprising a unique subset of EEG recordings. This approach enables us to mimic an object-distributed environment, where data are stored initially across multiple sources or locations, and each model learns from its respective local data without access to the full dataset. Each trained model outputs a class probability vector for a test instance \(\hat{x}\), structured as \([\mu_{i,1}(\hat{x}),\ldots,\mu_{i,c}(\hat{x})]\), where \(\mu_{i,j}(\hat{x})\) is the support for class \(j\) provided by model \(i\), and \(c\) is the number of decision classes. These prediction vectors serve as the basis for our ensemble fusion framework. To go beyond conventional majority voting, we implement a dynamic ensemble selection framework. This approach dynamically identifies, for each test instance, a subset of models--called a coalition--that will participate in the final decision. The coalition is constructed individually for every tested object, making the ensemble configuration adaptive and context-aware. We formally represent each local dataset as a decision table: \(D_{i}=(U_{i},A_{i},d)\) denotes the set of EEG signal instances, \(A_{i}\) the features (e.g., statistical, spectral, or wavelet-based descriptors), and \(d\) the decision label (e.g., ictal vs. inter-ictal state). Due to the distributed nature of the data, features and samples may vary between tables. To form coalitions, we use a conflict matrix approach. Each model's prediction vector is evaluated to determine its stance on each class. For a class \(v\), a model's support is encoded by a function \(v(i)\in\{-1,0,1\}\) defined as follows:  
\[v(i)=\left\{ \begin{array}{ll}1&\text{if the coordinate $\mu_{i,v}(\hat{x})$ for decision $v$ in the prediction vector of}\\ &\text{model $i$ has the maximum value of all coordinates in this vector.}\\ 0&\text{if the coordinate $\mu_{i,v}(\hat{x})$ for decision $v$ in the prediction vector of}\\ &\text{model $i$ is this vector's second highest of all coordinates.}\\ -1&\text{in other cases}\end{array} \right. \tag{1}\]  
Using these encodings, a conflict function \(\rho(i,j)\) measures the disagreement between models \(i\) and \(j\) as the proportion of decision classes where their opinions differ. Formally,  
\[\rho(i,j)=\frac{card\{v\in V:v(i)\
eq v(j)\}}{card\{V\}}, \tag{2}\]  
where \(card\{V\}\) is the cardinality of the set of decision classes and \(i\) and \(j\) are local models. Two types of coalitions are constructed:  
* Unified coalitions, where \(\rho(i,j)<0.5\) for all pairs in the group, capturing groups of models that largely agree. * Diverse coalitions, where \(\rho(i,j)>0.5\), representing models with significantly differing perspectives. These coalitions are generated dynamically per test instance, allowing the ensemble structure to adapt to each prediction task. Importantly, models may belong to multiple coalitions simultaneously, reflecting overlapping perspectives, as commonly seen in real-world ensemble behavior. For decision-making, we focus on the strongest coalition--the one with the highest number of members.