dataesr/scientific-paragraphs-categorization huggingface dataset:
, 2006). Note that the synergies w i are sample-independent, whereas the parameters t s i and c s i must be adjusted for each sample (i. e. , trial or task). We fed the dataset to the time-varying synergies extraction algorithm to identify a set of muscle synergies and their activation coefficients that reconstructed the entire set of muscle patterns with minimum error. The number of extracted synergies N is a parameter of the model, and thus we repeated the extraction with a number of synergies ranging from 1 to 8. In order to minimize the probability of finding local minima, for each N, we ran the algorithm 10 times using different random initializations of the synergies and coefficients and selected the solution with the lowest reconstruction error. We used a convergence criterion of ten consecutive iterations for which the average error was decreased by less than 10 -6.
Synergy similarity We assessed the robustness of the synergy sets extracted from different experimental datasets as done in  (D'Avella et al. , 2003). In brief, we quantified the similarity between pairs of synergies as their correlation coefficient. For evaluating the similarity of the whole ensembles of synergies recorded in different datasets, we started by selecting the pair with the highest similarity, and then the synergies in that pair were removed from their sets. We then computed the similarities between the remaining synergies and repeated this procedure until all synergies in the smallest set had been matched. In the case of time-varying synergies, we computed the correlation coefficient of the two synergies over all possible delays and selected the delay that maximized similarity (see D  'Avella et al.
CLASSICAL VAF-BASED CRITERIA FOR ASSESSING THE VALIDITY OF SYNERGY DECOMPOSITIONS AND FOR SELECTING THE SMALLEST SET OF SYNERGIES The purpose of this study is to develop a methodology to select, in a considered dataset, the smallest set of synergies that accounts for all task-discriminating variability in the recorded EMG dataset. Before we describe this new methodology, in this Subsection we briefly summarize the current methodology to choose the set of synergies used to decompose a dataset. Synergy selection can be cast as a model selection problem, because different synergy decompositions are obtained when varying the number of extracted synergies. In the literature, there are typically ad-hoc criteria to assess the number of synergies, all based on the dependence of the amount of explained variance on the number of synergies extracted (N).
9) is exceeded ("VAF-T" criterion)  (Torres-Oviedo et al. , 2006) , (b) the point at which the highest change in slope (the "elbow") is observed ("VAF-E")  (Tresch et al. , 2006) , (c) the point at which the curve "plateaus" to a straight line ("VAF-P")  (Cheung et al. , 2005)  and (d) the point at which any further increase in the number of extracted synergies yields a VAF increase smaller than 75% of that expected from chance ("VAF-S")  (Cheung et al. , 2009b). VAF-S is implemented by first shuffling the EMG data across muscles and time steps and then extracting synergies from this "randomized" dataset. The VAF curve obtained from this decomposition exhibits an almost linear increase. Comparison of its slope with the slope of the real VAF curve at its point gives the selected number of synergies.
NEW TASK-DECODING BASED CRITERION FOR ASSESSING THE VALIDITY OF THE SYNERGY DECOMPOSITION AND FOR SELECTING THE SMALLEST SET OF SYNERGIES In this section, we present an additional method to quantitatively evaluate muscle synergies in task space and to automatically identify the smallest set of synergies that captures all the variance describing single-trial task-to-task variations in the dataset. To this aim, we first used a single-trial decoding analysis to quantify how well the single-trial coefficients of individual synergies or groups thereof discriminate between different tasks. A similar analysis has been implemented in the past in the context of muscle synergies  (Brochier et al. , 2004; Weiss and Flanders, 2004; Overduin, 2005)  and in studies of modularity in the kinematics space  (Santello and Soechting, 1998; Santello et al.
Each point is assigned to the class represented by the colored region on which it lies. (ii) The quadratic discriminant (QDA), i. e. , a discriminant algorithm that assumes unequal variances across classes leading to quadratic decision boundaries. (iii) The Naive Bayesian classifier (NB) which assumes that data points are independent with Gaussian in-class distributions and calculate the most likely class using Bayes theorem. (iv) The k-Nearest-Neighbors classifier with Euclidean distances (k-NN)  (Duda et al. , 2001). We set the number of neighbors k (a free parameter) to k = 10 because empirical investigations revealed that this selection maximized decoding performance for the dataset examined. Unless otherwise stated, in this paper we relied on decoding using a LDA, because of its high computational speed and performance on the datasets considered here.
(C) ), and 5 ) "ground-truth" synergies. For noise levels, , 4 The kinematics data were low-pass filtered (Butterworth filter, cut-off frequency of 20 Hz) and numerically differentiated to compute tangential velocity and acceleration. Movement onset and movement end were identified as the times in which the velocity profile of the fingertip superseded 5% of its maximum. The mean movement duration varied across subjects from 370 to 560 ms. We verified that for all the subjects included in this analysis none of the muscles showed a systematic change in signal amplitude across the recordings sessions, which would be an indication that the EMG sensors were partially detached from the skin.
GENERATION OF SIMULATED EMG DATASETS To demonstrate the validity of our method and investigate its robustness, we tested it on simulated single-trial EMG responses in which the "ground truth" about which synergy set actually generated the data was known by construction, and that contained physiologically plausible sources of single-trial variance. We constructed two synthetic datasets by linear summation of a small number (from 2 to 5, depending on the simulation) of either synchronous or time-varying synergies and corrupted them with different physiologically plausible sources of single-trial variance: motor noise on the synergy activations and additive signal-dependent noise. The amount of each type of noise was parameterized by two separate free parameters: v and a respectively. The first EMG dataset (simulation of synchronous synergies) was generated as a weighted combination of set of synchronous synergies according to Equation  2.
g. , time-averaging of the muscle activities). However, the model can readily incorporate temporal variability too. In our simulations, we assumed that, to execute a motor task, each one of the N synergies was activated by a scalar coefficient drawn from a uniform distribution in the [0,1] interval. So, each task was represented as an N-dimensional vector of activation coefficients. The variability in the neural motor command, which in turn leads to trial-to-trial variations of the synergy coefficients in each task, was modeled as additive white Gaussian noise with covariance matrix v 2 I. Hence, we varied the parameter v to modulate the trial-to-trial variability of the synergy recruitment for each task. To construct the second simulated dataset (simulation of timevarying synergies), we used the time-varying synergies (from N = 2 to 4) and the corresponding scaling coefficients extracted from the single-trial experimental data of the typical subject (Figures  3A, B ).
Importantly, this simulated dataset was built such that, without any source of task-unrelated variability, the underlying set of synergies is theoretically sufficient to produce the EMG patterns of 9 muscles for the execution of 8 motor tasks and such that, even with other sources of noise added, all task-discriminating variations are described by the scaling coefficients of the "ground-truth" synergies. We computed the means of the extracted coefficients for each motor task and fitted their distributions with N-dimensional Gaussians. Based on these data, we modeled the motor noise that corrupts the coefficients and delays as a Gaussian whose standard deviation (SD) is a fraction v of the SDs measured on real EMGs. A value v = 1 corresponds to the amount of variability empirically found on real data, whereas v > 1 corresponds to trial-to-trial synergy recruitment variability larger than that of the experimental data.
From the resulting Gaussian distributions, we generated 40 sets of activation coefficients c s i per task which scaled the extracted synergies w i (t) according to Equation 1 to generate the simulated EMG dataset consisting of 9 muscles and 40 trials × 8 tasks = 320 samples. The duration of each sample was 50 time steps. For both simulations, the resultant data were then corrupted by task-unrelated variability during movement execution. This was done by adding the noise term ε s (t) in Equations 1, 2. Muscle activation patterns have been reported to be corrupted by noise that scales with the amplitude of the motor signal, termed as signal-dependent noise  (Tresch et al. , 2006). Such noise whose SD is proportional to the amplitude of the noiseless EMG was added on each muscle's simulated EMG activity.
, 2006)  in simulations and in  (Torres-Oviedo et al. , 2006; Torres-Oviedo and Ting, 2007)  with real data]. In Figure  4A  (top), we show a total of 30 sample points (10 for each task). Muscle synergy identification consists in finding basis vectors spanning a lower-dimensional linear space in which the original data can be accurately described: in this case we extracted two synergies with non-negativity constraints (the arrows w 1 and w 2 ) that approximate at best the data by a 2-dimensional hyperplane defined by the 3-dimensional synergy vectors (Figure  4A  top). This representation is considered good if the approximation error (i. e. , the residual error r (j) ⊥ ), defined as the distance of the data points from the hyperplane, is low. The currently most exploited metric to determine the set of synergies best describing a dataset is the VAF measure, which quantifies the proportion of variability in the EMG data set that is accounted for by the muscle synergy decomposition (see Equation 3 in section "Materials and Methods" for the exact definition).
This additional metric is necessary for the evaluation of muscle synergy representations with respect to task identification. We further illustrate in Figure  4B  the complementarity of the two metrics (VAF and decoding based) by considering EMG datasets corrupted with extreme levels (either high or low) of both types of variability described above. These datasets were generated from the five synchronous synergies shown in Figure  2A  (see section "Materials and Methods" for details) and in all cases the noise levels were restricted so that the original synergies could be recovered from the synergy extraction algorithm (Figure  2B ). Note that with very large noise, the original synergistic structure can be hidden or lost and therefore the extraction algorithm may fail to extract the correct synergies.
This may happen either because such extra synergies are activated always in the same way in all tasks (something that can be tested by verifying that when considered individually they lead only to random task decoding) or that they do not add any task discrimination to that already carried by the minimal set of synergies determined by the decoding metric. Careful decoding analysis of the individual extra synergies contributing to VAF but out of the minimal task-decoding set may be useful to individuate synergies (e. g. , postural synergies) that may be important for generating the appropriate movements even if their activation is constant across tasks. A second possibility is that decoding selects a larger set of synergies than VAF. This case indicates that some synergies (because e. g. , they have little signal amplitude) do not explain a large part of the variance of the dataset, yet they provide unique information about task-to-task differences not carried even by other synergies in the set with larger amplitude.
SIMULATION STUDIES OF THE ROBUSTNESS OF THE DECODING-BASED METHOD To demonstrate and test our novel method for selecting the set of synergies that describe all task-related differences at best, we used two types of simulated datasets (one for each type of muscle synergy model, see section "Materials and Methods" for details). Importantly, in both simulated datasets, which contain both task-discriminating and non-discriminating ("noise") variance, we know by construction the number of synergies sufficient to describe the entire task-discriminating part of the EMG variance. This allows a direct evaluation of the performance of the method against a ground truth. Moreover, by manipulating the parameters (such as the level of noise, or the number of true synergies, or the number of samples recorded), we can investigate how these variables affect the quality of synergy detection.
Assessment of the method's performance when applied to synchronous synergies Varying the number of "ground truth" synergies. First, we checked the extent to which our method could identify the correct set of synergies that generated the data, by varying the number of ground-truth synergies from which we generated the simulated EMG data. More precisely, we simulated three, four or five synchronous synergies (see section "Materials and Methods") and corrupted them with both types of noise (a = 0. 1 and v = 1). After extracting muscle synergies from the simulated datasets, we obtained the VAF and decoding curves reported in Figures  2C-E. In all three cases, the ground-truth sets of synergies that explain the task-discriminating variations were correctly individuated, indicating that our method reliably detects synergy sets independently of the precise number of synergies.
Varying the sources and levels of noise. We then estimated the effect of varying the amount of the two types of physiological noise. In these further investigations, we generated the data using all 5 simulated synchronous synergies (plotted in Figure  2A ). In particular, we tested how noise differentially affects the selection of synergies with our decoding method and with standard VAF criteria. (The threshold for the VAF-T criterion was set to 0. 9 in all subsequent simulations). We started by generating an EMG dataset with a set of "reference" values of the noise parameters (a = 0. 1 and v = 0. 1) on which we performed the subsequent synergy-identification and decoding analysis. Figure  2E  shows that the decoding method correctly identified the number of synergies expressing taskdiscriminating variance.
This already suggests that the decoding metric is quite robust to the presence of task-irrelevant variance in the data set. In the subsequent simulations, we increased the level of one noise parameter at a time in order to gain some intuition about the dependence of the VAF and percent correct metrics on these different sources of noise and also examine the robustness of our method to higher levels of noise. First, we examined the impact of increasing the signaldependent noise. We increased the signal dependent noise parameter to a = 0. 3 keeping v unchanged. The VAF drastically decreased indicating its susceptibility to the unstructured additive noise (Figure  2F ). In fact, in the limit of very large additive noise (e. g. , due to very noisy recordings), the VAF curve exhibited an almost linear increase with low slope implying that a large number of synergies would be required to explain the variance of the dataset (see e.
g. , Figures  2F, H ). These findings highlight a degree of arbitrariness in selecting synergy sets by setting thresholds purely based on VAF criteria, as VAF contains also noise variance and thus choice of a good threshold crucially depends on the amount of noise in the considered dataset. More specifically, in the high additive noise case, the VAF-based criteria select a very large number of synergies because the curve neither reaches the 0. 9 threshold nor plateaus. On the other hand, the percent correct metric exhibited robustness to additive noise demonstrating only a slight decrease (Figure  2F ). Hence, by attempting to decode the task performed, we can discount task-unrelated variance and we can still identify the synergies that account for task-discriminating variability in a general way and separate them from those explaining unstructured noise in the data.
Second, increasing signal-dependent noise (v = 0. 3) does not change the VAF curve (Figure  2G )meaning that the whole dataset can still be reconstructed with low error-but produces synergies whose activations are more variable across trials, i. e. , the motor tasks are performed in a less stereotyped way, which causes the decoding performance of the extracted synergies to decrease. However, although the decoding ability of the extracted synergies is decreased, our method is still able to detect the four synergies that explain all the task-relevant variability in the dataset (Figure  2G ). Note that in the limit of very large motor noise, decoding would tend to chance level while the VAF would still be near 100% (see e. g. , Figure  4C ). In such an extreme case, our decoding algorithm would correctly detect that the synergies (though they explain the variance of the data) cannot be used for identifying and selecting the task-discriminating movement features.
In fact, the mapping between synergy activations and tasks executed would be completely random, proving the non-usability of this synergistic structure for accurate motor control. Finally, we increased both types of noise simultaneously (a = 0. 3 and v = 0. 3). Consequently, both curves fell to lower values. However, although the VAF curve did not exhibit any elbow or saturation point, the decoding curve had a clear peak at N = 5 demonstrating the robustness of our approach to high levels of any type of variability (Figure  2H ). Varying the number of samples. Because the datasets that can be obtained experimentally are composed of a limited number of trials, we investigated how this limitation may affect the performance of our method. Our aim was to assess the smallest number of repetitions of each motor task that can guarantee reliable selection of the set of muscle synergies that account for all the task identification power.
In these simulations we used the same noise levels as the ones in Figure  2E  (a = 0. 1 and v = 0. 1). We generated 5 repetitions of each simulated motor task, i. e. , 5 trials × 8 tasks = 40 samples, and corrupted them with 20 different instances of noise yielding 20 different simulated datasets. On these datasets we implemented our decoding-based method and computed how many times it gave the correct result (five). We repeated the same when simulating 10 and 20 repetitions of every motor task. Figure  5A  shows that 10 trials per task were sufficient to determine the five synergies in the vast majority of the algorithm runs, while when 20 trials were used the algorithm identified the number of synergies always correctly. In general, we found (results not shown) that increasing the number of samples caused a reduction of both the variance of the decoding performance at fixed number of synergies and of the confidence intervals of the "null hypothesis" (indicated as a shaded red area in Figures  2, 3 ), which in turn both contribute to increasing the stability of the method.
In the case of five trials, although the correct number was found in most cases, sometimes the algorithm underestimated the number of underlying synergies because relying on only 5 trials per task rendered our test of statistical significance not reliable. So, the synergies contributing the least to describing task-related differences were often falsely excluded. Using different decoding algorithms. To validate that our results do not depend on the specific choice of single-trial decoding algorithm (LDA) we applied our methodology to the simulated dataset constructed from the five synergies (Figure  2A ) corrupted with the "reference" noise values (a = 0. 1 and v = 0. 1) and 40 simulated trials per task using a wider range of classification algorithms (see section "Materials and Methods" for details).
Extension of the method's applicability to time-varying synergies So far, we validated our method on EMG data described by synchronous synergies. However, it is readily applicable to any type of representation of muscle activation patterns. To demonstrate its robustness independently of the underlying model, we repeated all the tests performed above with simulated data generated from four physiologically plausible time-varying synergies (see section "Materials and Methods"). The reference values of the noise parameters v = 1 and a = 0. 1 used in these simulations were set so that the amount of task-discriminating and non-discriminating variability in the simulated data matched those measured in the experimental data based on which we built the simulations. We note that in all cases adding realistic amounts of noise-as the ones expressed by the parameter values used in all subsequent simulations-allowed accurate reconstruction of the shape of the underlying synergies (shown in Figure  3A ).
The number of trials needed to identify the synergy set is likely to increase with the number of recorded muscles (because decoding in a higher dimensional space with small dataset is more difficult) and with the level of noise (due to the difficulty in detecting patterns in noisy conditions). Whereas our simulations demonstrate that our method can detect reliably the synergy set with feasible amounts of data, for the reasons indicated above it is valuable to evaluate the minimum number of trials at a preliminary stage using simulated data (such as those considered here) constructed with statistical properties as similar as possible to the actual experimental data of interest. Finally, we examined whether other decoding algorithms yield the same results for the time-varying synergies too (Figure  5C  right).
IDENTIFICATION OF THE SMALLEST SYNERGY SET THAT ACCOUNTS FOR ALL TASK-DISCRIMINATING VARIABILITY IN SINGLE-TRIAL SYNERGIES EXTRACTED DURING CENTER-OUT POINTING. To illustrate the ability of our methodology to identify synergy sets on real data, we applied it to a dataset of EMG activity recorded during an experimental protocol (fully described in section "Materials and Methods") comprising of many repetitions of a variety of point-to-point reaching movements. For each one of the four subjects tested, we formed an EMG matrix of dimensions 9 muscles × (50 time steps × 320 samples) consisting of all the movement-related EMG activity (rectified and filtered) of the 9 muscles for all samples recorded. In order to illustrate our methodology first, we present extensive results from the analysis of only one ("typical") subject's EMG dataset.
In sum, a small set of time-varying or synchronous synergies described all task-related differences in the examined EMG datasets. This set of synergies would have been hard to select relying on VAF-based criteria, because some of the standard criteria would exclude synergies that express task-discriminating muscle activations and contribute to the generation of each task, while others would include synergies that explain only task-irrelevant variations reflecting different sources of noise in the recorded data.
In sum, in this particular dataset the synchronous synergy model was slightly more effective at describing taskdiscriminating variability than the time-varying one when the time course of synchronous synergies was modeled by three or more parameters. This corresponds to a slight increase in model complexity with respect to the use of time-varying synergies whose single-trial activation is described by two parameters per synergy. However, when using the same number of parameters, time-varying and synchronous synergies explained the same amount of task-discriminating variability.