## 2 Materials and Methods
### Model Metrics and Evaluation  
To reliably assess the neural network's performance, we employed k-fold cross-validation using labeled EMG hand gestures from multiple patients [8; 13]. The parameters were set to 10 folds and 100 iterations, yielding a mean performance metric for the network (see Figure 6). For each iteration, data from 23 patients were randomly allocated to the training set and data from 2 patients to the testing set. For the bilateral fusion, all non-paretic data was integrated into the network's learning process (i.e., non-paretic hand movement data from  
Figure 5: EMG-driven CNN-LSTM neural network architecture for decoding paretic hand gestures. the same patients was used only for training, not for testing). For the comparison group, paretic data was trained and tested separately without non-paretic EMG data. For evaluation purposes, we used the sensitivity (SENS), specificity (SP), accuracy (ACC), and F1-score (F1) to assess DNN performance across the paretic and fused EMG gesture datasets [8; 26]. SENS, or the true positive rate, measures the ability of DNNs to correctly identify positive instances (e.g., high sensitivity scores indicate that the resting state was accurately classified as rest by the classifier). SP is the proportion of true negatives among all actual negatives, reflecting the model's ability to avoid misclassifying gestures (e.g., preventing false classification of the resting state as flexion or pinch) [8]. ACC measures the proportion of correctly predicted gestures, reflecting overall performance [2; 3; 11; 15; 16; 17; 18; 19; 23; 26]. F1 quantifies the balance between precision and recall, providing a robust metric for imbalanced datasets common in clinical studies [2; 13; 21; 22]. Therefore, precision scores were not evaluated independently but were considered as components of the F1 metrics. A statistical comparison was conducted between the performance metrics from the paretic dataset (split into training and testing sets) and the fused dataset, which included non-paretic EMG data from identical gesture classes. Metrics were compared using an unpaired \(t\)-test, with significance thresholds defined as \(p<0.05\) (significant), \(p<0.01\) (very significant), \(p<0.001\) (highly significant), and \(p<0.0001\) (extremely significant) [14]. To evaluate our DNN's effectiveness with imbalanced EMG data, we used the Area Under the Receiver Operating Characteristic Curve (AUC-ROC) to assess the performance across gesture classes. The ROC curve plots the true positive rate against the false positive rate across multiple thresholds, demonstrating the model's discriminative power above chance. The AUC, ranging from 0 to 1 (with 1 indicating perfect classification), offers a single metric of performance per gesture class after cross-validation [8]. Unlike a confusion matrix, the AUC-ROC mitigates misleading interpretations from class imbalance, especially when one gesture dominates, thus providing a balanced evaluation in a multi-class setting. Moreover, the ROC curve enables assessment of the model's ranking capability by analyzing prediction probability distributions, offering deeper insight into per-gesture classification performance. Custom scripts for filtering EMG data, learning, testing, cross-validation, and statistical analysis were made and run using MATLAB (R2024b, The MathWorks, Inc., Natick, MA, USA) on a Windows 11 system equipped with an Intel(r) Core(tm) i9-7900X CPU, 128 GB RAM, and an NVIDIA(r) RTX A4000 GPU (16 GB). Additionally, they were executed in  
Figure 6: Bilateral data fusion of paretic and non-paretic hand gestures in post-stroke patients. _E_—number of iterations in cross-validation; the green circle represents non-paretic gestures concatenated into subsets; the red circle represents paretic data, randomly selected during cross-validation; the combined circle represents the fused data during training.