Abstract
The decomposition of multiunit signals consists of the restoration of spike trains and action potentials in neural or muscular recordings. Because of the complexity of automatic decomposition, semiautomatic procedures are sometimes chosen. The main difficulty in automatic decomposition is the resolution of temporally overlapped potentials. In a previous study [1], we proposed a Bayesian model coupled with a maximum a posteriori (MAP) estimator for fully automatic decomposition of multiunit recordings and we showed applications to intramuscular EMG signals. In this study, we propose a more complex signal model that includes the variability in amplitude of each unit potential. Moreover, we propose the Markov Chain Monte Carlo (MCMC) simulation and a Bayesian minimum mean square error (MMSE) estimator by averaging on samples that converge in distribution to the joint posterior law. We prove the convergence property of this approach mathematically and we test the method representatively on intramuscular multiunit recordings. The results showed that its average accuracy in spike identification is greater than 90% for intramuscular signals with up to 8 concurrently active units. In addition to intramuscular signals, the method can be applied for spike sorting of other types of multiunit recordings.
Keywords: Adult; Algorithms; Bayes Theorem; Computer Simulation; Electromyography; Evoked Potentials; physiology; Humans; Male; Markov Chains; Models, Statistical; Monte Carlo Method; Muscle, Skeletal; physiology; Reproducibility of Results; Signal Processing, Computer-Assisted; instrumentation; Stochastic Processes; Young Adult
I. Introduction
Invasive electrodes inserted into the brain, nerves, or muscles provide multiunit recordings consisting of the activity of neural cells or muscle fibers that respond to the activity of motor neurons. In several applications, it is necessary to decompose these multiunit recordings into the individual sources, i.e. to identify the individual unit spike trains from the interference signal. For example, the decomposition of intramuscular recordings provides information on the behavior of spinal motor neurons. The decomposition problem of multiunit recordings, often referred to as spike sorting, is usually solved with template matching approaches [2]. In some of these approaches, the action potentials that are overlapped in time are not classified and are considered outliers [3]. When the number of sources is small, this limitation may provide an acceptable amount of information on the sources under study. However, when there are many sources active concurrently, overlapped action potentials constitute the majority of the potentials in the recorded signals. Therefore, in some template matching methods, the superpositions are resolved by iterative subtraction of all possible template combinations from unidentified waveforms [4,5]. As an alternative, neural network classifiers are applied to resolve the superposition problem by introducing overlapped spikes into the training data [6].
The main challenge underlying the resolution of superimposed spikes is that the global optimization problem is non-deterministic polynomial-type (NP) hard, i.e., it cannot be solved by polynomial complexity algorithms [1]. Therefore, the existing methods either perform on the restrained search spaces [4,7], which reduces the complexity, or are based on recursive algorithms [8,9] with specific trial strategies and residual threshold estimations. For example, Atiya [7] proposed a robust approach for decomposing overlaps of action potentials in neural recordings by comparing all possible combinations of up to two action potentials (restrained search space). Within the family of spike sorting algorithms, the dynamic programming method [4], which uses the fast exploration technique of a k-d tree, is also limited by the memory space necessary to generate such data structure, resulting in practice in an equally restrained search space of up to two overlapping action potentials. This constraint is not justified in several applications. Similar issues arise when determining a representative training set of overlapped spikes and then using neural networks to identify overlapped sources [6].
Other approaches are not limited in the number of overlapping sources but require an interaction with an operator. For example, a recent algorithm for decomposing intramuscular electromyographic (EMG) signals into the constituent motor unit spike trains recursively matches the templates and reevaluates the residual errors, until it is able to prove that it has found the global optimum [8]. To avoid too long recursions in cases of difficult spike superpositions, the algorithm stops and requires an expert intervention after a number of trials without reaching the lower bound value.
Other methods make use of independent component analysis (ICA), of clustering and ICA [10,11,12] to avoid the limitation on the number of units concurrently active and the need for the intervention of an operator. However, these methods are applied to multi-channel recordings. Similarly, blind source separation (BSS) approaches such as the Convolution Kernel Compensation (CKC) used for surface EMG decomposition [13,14], are usually applied to multi-channel recordings for which at least as many channels as sources are needed.
A Bayesian model coupled with a maximum a posteriori (MAP) estimator was recently proposed for fully automatic decomposition of multiunit recordings in single-channel signals [1]. The method was tested on intramuscular EMG recordings to identify individual motor unit spike trains and proved to have similar performance as obtained with a semi-automatic decomposition by expert operators [1]. Furthermore, the number of concurrent action potentials was not limited although the search space augmented exponentially.
One assumption of the Bayesian model in [1] is that action potentials discharged by a unit have the same amplitude and shape for the entire recording. However, although the shape of action potentials may not change substantially, the amplitude may be variable in some conditions. For example, the amplitude of single motor unit action potentials in intramuscular EMG may be influenced by the rate of discharge because of the velocity-recovery function of muscle fibers [15]. Moreover, small displacements of the recording electrodes with respect to the sources may influence action potential amplitude.
In this study, we address the spike sorting problem in single-channel recordings by proposing a more complex signal model than in [1]. This model includes the variability in magnitudes of each unit potential to provide a better fit with the experimental signals in a least-squared-residual sense. Since action potentials may also change in shape, which is not modeled, this new model is not expected to provide a perfect fit. However, it is hypothesized that it would provide better overall performance compared with the invariant amplitude and shape model. Moreover, instead of the MAP estimator [1], we propose a new approach for the solution of the spike sorting problem. The approach is based on the Markov Chain Monte Carlo (MCMC) simulation tool to build a minimum mean square error (MMSE) estimator for continuous parameters and a marginal MAP estimator for discrete parameters (discharge instants) using samples that converge in distribution to the joint posterior law. The study also provides the mathematical proof of the convergence property of this approach. As in [1], the proposed method is representatively tested on intramuscular multiunit recordings, although it can also be directly applied to other multiunit signals. The test on intramuscular EMG signals will allow a direct performance comparison with the MAP estimator previously proposed [1]. The main part of the validation is performed on experimental data, however we also present results on EMG signals simulated with very irregular spike trains as a proof of its robustness.
II. Model with variable impulse magnitudes
The generation of a multiunit recording is schematically represented in Fig. 1. Each impulse train is convolved by a characteristic action potential whose shape is assumed to vary minimally during the recording.
Fig. 1.

Multiunit direct model.
The direct problem model can thus be expressed mathematically as a convolution product:
| (1) |
where z is the recorded signal of length N, si, i = 1, …, I and hi, i = 1, …, I are the impulse trains (the discharge patterns) and their linear filters (action potentials) respectively. Note that in the present study, the impulses in si can have different amplitudes reflecting the amplitude variation of the different action potentials in the train. (●)i denotes the set {●, i = 1 …, I}, e.g., (si)i = {si, i = 1 …, I} gathers the discharge patterns of all impulse trains.
Assuming that ε is an independent, identically distributed (i.i.d.) Gaussian noise with unknown variance , the likelihood of the data, given the source parameters (si, hi)i, can be written:
| (2) |
A. Prior laws on parameters
The modeling of the impulse trains (si)i is based on the following assumptions and notations:
-
A1)
(si)i are supposed mutually independent discrete time impulse trains;
-
A2)
the coordinates of non-zero elements (discrete discharge instants) in each si are contained in a vector noted as xi;
-
A3)each s conditional to xi and is supposed to be a truncated Gaussian:
(3) where 1xi is binary vector with ones at positions xi, and diag(1xi) is the diagonal matrix whose diagonal is 1xi.
The sparsity in each spike train is modeled by the vector xi, whereas the variability in the amplitude of spikes generated by the same source is taken into account via the conditional Gaussian law (Eq.(3)). We note that negative magnitudes are not relevant in spike sorting, thus the law of the magnitudes should be a Gaussian truncated to the positive hyperoctant, i.e., 1si≥0 imposes a non-negative constraint on each element of si.
In the literature, the Bernoulli-Gaussian (BG) model has been adopted for the restoration of a sparse and magnitude variable train [16,17,18,19]. The BG model first defines the discharge instants xi using the Bernoulli law:
where ni = dim(xi) denotes the unknown number of discharges, and λ ∈ (0, 1) the Bernoulli parameter; and then defines si conditionally to xi as a Gaussian variable, in the same manner as in Eq. (3). Let us remark that a Gaussian random variable with zero-variance corresponds to a variable of constant value (the Gaussian mean m), for which the distribution can also be defined as a Dirac.
On the other hand, the Bernoulli model needs also adaptations when used for neural spike trains, in order to account for physiological constraints. In this study, the model of the impulse instants (xi)i is based on the following assumptions:
-
A4)
the inter-spike interval (ISI) Tij = xi,j+1 − xi,j, or the temporal distance between two consecutive impulses of the same source, is assumed to be larger than a threshold value TR. This value represents the refractory period needed to discharge the spikes and thus depends on the specific application; e.g., for intramuscular EMG decomposition, it is the absolute refractory period of muscle fibers;
-
A5)
among all the admissible solutions satisfying the refractory period condition, spike trains that are more regularly spaced are favored. Following [1], this is achieved by a Gaussian-shaped distribution on the variables Tij – TR.
The resulting law of xi (in a discrete, regularly sampled time framework) for each unit can be written:
| (4) |
where
and
= {xi, xi,j+1 − xi,j > TR for all j} is the set of admissible xi satisfying the refractory period condition,
is the indicator function of
:
Contrarily to the BG case, a spike train si is no more an i.i.d. sequence, because the discharge instants xi are not independent. In the BG deconvolution framework, a comparable model called modified Bernoulli process has been proposed in [20] to impose the minimum distance constraint on the impulse train. The integration constant depends on both mi and . In practice, the following approximation can be adopted:
| (5) |
under the assumptions that
σi is large enough to ignore the discretization error; e.g., for σi = 10ms and a sampling frequency of 10kHz, the 3σ Gaussian lobe is discretized by 600 samples;
σi/mi is small enough to ignore the integral truncation at −mi, typically if σi/mi < 1/3, then the truncation error is controlled at 0.135%.
Finally, in order to define a proper probability, Eq. (4) should be modified to incorporate a prior law on the first discharge instant xi1. Here we suppose it is uniform for the sake of simplicity.
Using the independence assumption A1, we obtain:
| (6) |
B. Joint posterior law
In the Bayesian framework, the posterior distribution P(Θ | z) for can be expressed:
| (7) |
Fig. 2 illustrates the hierarchical Bayesian model with all intervening parameters, among which unknown parameters (in Θ) are circled. The decomposition task consists of deriving an estimator Θ̂ from Eq. (7). We note that Θ contains both continuous and discrete parameters and that the combinatorial nature of (xi)i, precludes the exhaustive exploration method even in one segment [7].
Fig. 2.

Directed acyclic graph representing the hierarchical Bayesian model. Unknown parameters are circled in the graph.
Eqs. (2), (3) and (4) provide the likelihood term and the prior laws on (si, xi)i that enter the joint posterior (7). For the remaining terms, we choose conjugate priors with non-informative hyper-parameters (αi, βi)i, (αs, βs, μ0, ) (see [1] for a discussion on this choice):
where
stands for the inverse Gamma distribution and I is an identity matrix of appropriate size.
denote approximate spike shapes that are determined by the preprocessing step described in the following section.
III. Preprocessing
The resolution of superimposed spikes and complete decomposition is preceded by a preprocessing phase. The preprocessing consists of: 1) filtering the signal to enhance spike train activities, 2) segmenting the filtered signal into temporal intervals containing spikes [21,9], 3) classifying isolated individual spikes (those not overlapped temporally with others) to determine the number of units I and the approximate spike shape for each class .
The preprocessing steps described above have robust solutions described in the literature. The thresholding method proposed in [21] was adopted in this study for the segmentation. The classification of isolated action potentials can be performed with several techniques. For example, the canonically registered discrete Fourier transform (CRDFT) [22] or non-parametric Bayesian estimation (NPB) [23], have been proven to be effective methods for this purpose [24]. These solutions for segmentation and classification of isolated spikes have excellent performance and do not need substantial improvements. Therefore, the methods described in [21] and [22] have been used in this study for preprocessing. On the contrary, the decomposition of temporally overlapped spikes poses more challenges and is the main contribution of this study, as described in the following.
IV. Decomposition of overlapped potentials using MCMC
Markov chain Monte Carlo (MCMC) methods are a class of stochastic simulation algorithms used to construct a Markov chain whose stationary distribution is invariant and converges to the desired distribution after a number of iterations (burn-in period). The estimator is then calculated from valid samples (i.e., those after the burn-in period) and its quality improves as a function of the sample population according to the Monte Carlo principle. The Metropolis-Hastings (MH) and Gibbs algorithms are among the most classic algorithms in the MCMC family, while Reversible Jump MCMC (RJM-CMC) [25] further extends the application field by including variable dimension problems. These algorithms constitute widely used numerical tools in the field of Bayesian statistics and computational physics [26].
In the multiunit spike sorting context, the joint posterior law in Eq. (7) is considered as the distribution of interest. The Markov chain is generated using a Gibbs sampler, by re-sampling iteratively each parameter in Θ according to its posterior conditional law derived from Eq. (7) while fixing the other parameters. The choice of conjugate prior laws on { } facilitates the re-sampling on continuous parameters (steps (6–10) of Tab. I). The conditional laws to sample steps (6–10) are detailed in [1]. In particular, the conditional law for mi and are, respectively, Gaussian and Inverse Gamma if the two approximations (5) are satisfied.
TABLE I.
Stochastic simulation algorithm by MCMC.
| repeat |
| for k = 1 … K do % Integrate (si)i analytically |
| Sample |
| end for |
| Sample (si)i ~ P((si)i | Θ \ (si)i, z) |
| Sample (hi)i ~ P((hi)i | Θ \ (hi)i, z) |
| Sample (mi)i ~ P((mi)i | Θ \ (mi)i) |
| Sample |
| Sample |
| Sample |
| until number of iteration reached |
The difficulty lies in the sampling of the discrete parameters
1. We denote
as the set of firing instants
of all units in the k-th segment that satisfy the refractory period condition with respect to
. Thus, each element in
yields a non-zero joint posterior probability according to Eq. (4). Let us roughly evaluate the cardinality of
to stress the computational burden of sampling
. Even in a very favorable case for which at most 4 units are active in a segment of duration of 8ms sampled at 10kHz, we would have 814 < |
| < 2500. The inferior bound corresponds to a subspace of
containing at most one impulse for each unit in the segment. For segment lengths that vary between 8 and 60ms and number of units that varies between 4 and 8, the cardinal of |
| is at least 4.30 × 107 and 1.68 × 1022 in each case. Thus, sampling the conditional probabilities of
by evaluating all probabilities in the set
for each segment yields unrealistic computational load.
To solve this problem, we propose a Metropolis-Hastings algorithm summarized in Tab. I. The algorithm explores a subspace of
at each iteration Its validity is shown by verifying that the corresponding Markov chain remains irreducible: all configurations of non-zero probabilities (∈
) are explored with non-zero probabilities regardless of the initial state. This proof is provided in appendix. Consequently, the MCMC algorithm in Tab. I is a valid stochastic simulation algorithm, of Metropolis-Hastings within Gibbs type.
In what follows, Sections IV-A and IV-B enter into more details about the sampling of (first step in Tab. I): they respectively focus on its marginal conditional law and on the implementation of the Metropolis-Hastings step.
A. Marginal conditional law
We first rewrite the convolution sum in the following matrix form:
where H = [H1, …, HI] is composed of convolution matrices such that hi * si = Hisi, and S = [s1; …; sI ] represents a NI × 1 column vector by vertical concatenation. In the k-th segment, the data generation can be written:
where z(k) is the signal in the k-th segment; and denote the corresponding submatrix of H and subvector of S.
From Eq. (7), we obtain for each segment k the conditional law of . In the following, the term rest stands for the set {Θ, z}, except the concerned parameters.
| (8) |
where the k-th segment specific matrices are noted without the superscript (k) for simplicity:
δ(·) denotes the multi-dimensional Dirac function, and is the number of impulses of unit #i in the segment k. The vector 1 is a column vector of size while a1 and a0 are, respectively, the non-zero spike magnitudes of all units in the segment and its complement. {a1, a0} constitutes thus a permutation of spike trains S(k).
Let us remark that matrices G and V are functions of , but not of . It is thus possible to integrate out first a0, and then a1 in Eq. (8) since it is merely the product of two exponential terms and thus remains Gaussian.
The conditional probability of after marginalization of from Eq. (8) can be written:
| (9) |
where
Σ−1 and m are, respectively, the variance and mean of the Gaussian vector a1. Let us remark that the marginal law in Eq. (9) involves Σ−1 and m. In the special case where , Σ−1 and m cannot be defined. To obtain the marginal distribution, we first rewrite Eq. (8):
Integrating out and considering the common exponential factor w.r.t. cases where , its marginal probability then can be written:
| (10) |
Eqs. (9) and (10) describe the marginal conditional probability of up to a normalization factor.
The term can be directly derived from Eq. (4) and measures the regularity of the binary sequences (1xi)i for each spike train while the Gaussian variability of magnitudes of the spikes is expressed in the first two terms in Eq. (9).
We recall that though the marginal conditional probability of can be analytically expressed, its combinatorial space makes it a hard problem either to maximize (as proposed in [1] using a Tabu search) or to simulate the distribution using the MCMC approach. The next section proposes an MCMC algorithm that does not sample directly according to the conditional probability, but rather iteratively on local subspaces.
B. Metropolis-Hastings step
We propose here a reversible Metropolis-Hastings step to avoid the evaluation of all probabilities of
. The strategy is to explore a reasonable subspace of
per iteration while the exploration of the whole space
is mathematically guaranteed in the long run. We note that this strategy can be adapted to the full model that includes Gaussian variability in spike magnitudes.
Let ω(u) ⊂
be the local subspace (to be specified hereafter) to explore for each iteration and thus contains accessible configurations from the current configuration, noted by
of length I · dim(Segk). It is constructed by concatenating spike trains of all units in the segment k. In Tab. II, P(u) denotes the conditional probability as specified by Eq. (9) and (10) for a particular configuration u, F(u) the sum of probabilities of the configurations in ω(u), i.e., F(u) = Σy∈ω(u)
P(y), and q(u ↦ u+) the instrumental law or the probability of proposing u+ given the current state u. Note that Σu+∈ω(u)
q(u ↦ u+) = 1.
TABLE II.
Metropolis-Hastings step to sample in Tab. I.
|
In this application, we define ω(u) = {v | |u−v|1 ≤ 2 and ||u|1 − |v|1| ≤ 1} with | · |1 the L1-norm. The following conditions are verified:
|u − v|1 = 0 ⇔ u = v, s.t. u ∈ ω(u);
|u − v|1 = 1, adding or removing a spike;
|u − v|1 = 2 and ||u|1 − |v|1| ≤ 1, shifting an existing spike in the same spike train or being replaced by a spike in another train;
-
u ∈ ω(v) ⇔ v ∈ ω(u), together with condition 1), assures the reversibility of the chain: for all pairs (u, u+) ∈
,
where K(u ↦ u+) denotes the transition kernel derived from the Metropolis-Hastings step of Tab. II and equals to:(11) where the Markov chain is irreducible: it is capable of exploring the entire space
(see demonstration in Appendix);-
the Markov chain is also aperiodic since the kernel (11) satisfies:
by verifying that and ρ(u ↦ u) = 1. It is thus possible to have two consecutive samples that are identical, and such a Markov chain cannot be periodic.
the complexity per iteration (measured by |ω(u)|) remains linear with respect to to the segment length dim(Segk) and the number of units I.
In conclusion, the Markov chain generated from the proposed algorithm is irreducible, reversible and aperiodic. Therefore the only equilibrium distribution is P(u) (which means from any initial state u, [27, Theorem 1]).
The numerical implementation of the spike decomposition algorithm is summarized in Tab. III.
TABLE III.
Implementation of the MCMC algorithm.
| repeat |
| for k = 1, …, K do % for each segment k |
| % --- Metropolis-Hastings step--------- |
| Evaluate P(u+), u+∈ ω(u) in Eq. (9) (10) |
| Fu ← Σu+∈ω(u) P(u+) |
| Propose u* ~ P(u+)/Fu, u+ ∈ ω(u) |
| Accept u* with probability ρ = min {1, Fu/Fu*} |
| % ---- Magnitudes sampling ------ |
| if then |
| V ← diag(d) |
| Q ← chol(Σ−1) % Cholesky factor of Σ−1) |
| iid Gaussian vector |
% a1 ~
(m, Σ), Eq. (9)
|
| end if |
| end for |
| % - Sampling of remaining parameters [1] - |
| h = [h1; …; hI], h ~ P ((hi)i | rest) |
| For each mi, mi ~ P ((mi)i | rest) |
| For each |
| For each |
| until number of iteration reached |
C. Bayesian estimators
With the convergence property of the Markov chain, we thus obtain for each parameter in Θ a population of random samples distributed according to its marginal posterior law P(·|z). For continuous parameters, i.e., Θ \ (xi, si)i, a minimum mean square error estimator (MMSE) optimizes the following criterion:
According to the Monte Carlo principle, this estimator is approximated by:
where {yj}j=1,…,N are simulated samples, N0 and N represent, respectively, the number of burn-in iterations and the total number of iterations. In our tests, we fixed N = 2N0 = 200.
The same estimator, however cannot be applied on the discrete parameters (xi)i since averaged firing instants do not have any physical interpretation. Note that different samples may contain vectors of (xi)i of different dimensions since the number of detected spikes are not fixed. An alternative is to estimate binary sequences (1xi)i using a marginal component MAP detector, i.e., the marginal majority vote for each instant (component).
However, considering only one component marginally at a time may result in counter-intuitive estimators. Suppose for example that in an interval
, 2 < dim(
) < TR, the probability that there is one and only one detected event is 1 (
P (si,j ≠ 0) = 1) for a particular sample population. Further suppose that no one event is more likely than the sum of the others (in terms of probability), and thus P(si,j ≠ 0) < 0.5 for all j ∈
. From these assumptions, it would then follow that ŝi,j = 0 for all j ∈
, using the marginal component MAP detector. The result is clearly counterintuitive because the probability that there is no event in
is zero.
Recently, Kail et al. [20] proposed a MAP block detector. The main idea is to perform the majority vote on a block of the binary variables in 1xi. The number of binary combinations in each block should be much smaller than the number of available samples (the Markov chain length) while the length of the block is big enough to avoid false negatives using the marginal component MAP detector due to spike shifts in the sample population. The same strategy is adopted in this study for the estimation of the discrete parameters (xi)i.
V. Validation on experimental and simulated signals
A. Experimental signals
The method proposed can be applied to several spike sorting applications, such as intraneural or intramuscular recordings. The assumptions of the model include a refractory period, which can be set depending on the application, and the cost associated to the firing irregularity. Note that the latter does not imply that irregular firings cannot be identified but simply that a solution with very irregular firings is less favored than one with more regular firings.
The validation of the method was performed on a set of experimental intramuscular EMG signals, where the spikes represent the activation of spinal motor neurons. These signals were chosen for direct comparison between the proposed method with the Tabu search method proposed in [1]. The same experimental signals as described in [1] were thus used for this study.
Briefly, the experimental signals were recorded from the abductor digiti minimi muscle of five healthy men (age, mean ± SD = 25.3 ± 4.5 yr) with a pair of wire electrodes made of Teflon coated stainless steel (A-M Systems, Carlsborg, WA, USA; diameter 50μm) inserted into the muscle with a 25 G needle. The intramuscular EMG signals were amplified and provided one bipolar recording (Counterpoint EMG, DANTEC Medical, Skovlunde, Denmark) that was band-pass filtered (500 Hz–5 kHz) and sampled at 10 kHz. A reference electrode was placed around the wrist. The decomposition method was evaluated on intervals of 20 s of signals recorded during isometric contractions at 10% of the maximal voluntary contraction (MVC) force. The validation was performed by comparing the results of the proposed methods with those provided as reference results by manual decomposition of an expert operator using the EMGLAB tool. The proposed method was applied in a fully automatic way, without any intervention by the operator.
B. Simulated signals
The experimental signals were recorded in conditions where the firing patterns were expected to be rather regular (isometric contractions). In addition to experimental signals, the method was also applied to a set of simulated signals. This set of simulations was used to test the performance of the algorithm in cases of very irregular spike firings. The simulated signals were generated with the intramuscular EMG model proposed in [28] and also previously applied for the validation of the method proposed in [1]. The simulated signals were obtained by an imposed coefficient of ISI variation of 60%, corresponding to very irregular firings. The other parameters of the model were set as in a previous study [1], including the level of noise that corresponded to a SNR of 10dB). In total, five signals were simulated with the same set of parameters. These signals differed from each other because the shape of the action potentials were varied within the library of shapes of the model [28] and because the spike trains were generated randomly, according to the imposed statistics.
C. Performance index
The performance index for each spike source was defined as [29]:
where NDis(i) are spike numbers of the unit #i detected by EMGLAB for the experimental signals or simulated by the model for the synthetic signals. NFN(i) and NFP(i) are respectively the false negatives and the false positives with respect to the reference (EMGLAB or the model). A detected impulse was considered a correct one if within a 1ms-window centered on the instant of reference for the same unit. The global performance of the decomposition was then measured by the following index [29]:
For the experimental signals, discharge patterns for which σi/mi > 0.3 were excluded from the analysis, since the ISI variability of motor unit spike trains is usually lower than this limit in the experimental conditions [30,31]. Therefore, among the discharge patterns obtained by the application of the proposed method to experimental signals, only those satisfying the condition σi/mi < 0.3 were selected for analysis and the global performance criterion A was thus averaged on the A(i) of the validated units. This a-posteriori selection of sources is not necessary in other applications in which the firing instants are less regular. The decomposition results of simulated firings provide a test of the method in conditions of very irregular spike firing. The a-posteriori selection of sources was not applied to the simulated signals and results are reported as average over all motor units. Note that the ISI variability of the simulated spike trains is doubled compared with the upper limit imposed to the experimental spike train decomposition.
D. Results of decomposition
The constant parameters of the Bayesian model (Fig. 2) and the Markov chain initializations are listed in Tab. IV. σ̂ε are results of the preprocessing and we fixed σh = 0.1 max(h) in the tests.
TABLE IV.
Constant parameters in Fig. 2 and Markov chain initialization.
| m0 |
|
αi | βi | αs | βs | as | bs | |
| 100ms | (30ms)2 | 1 | 1 | 1 | 1 | 1 | 1 |
| mi |
|
si | xi |
|
hi | σε | ||
| 100ms | (30ms)2 | 0 | ∅ | (0.15)2 |
|
σ̂ε |
Fig. 3 shows an example of raw experimental signal and the decomposition of two adjacent segments with overlapped potentials using the proposed method. In this example, the fully automatic method proposed provided the same result as that obtained by the reference decomposition tool used by an expert operator.
Fig. 3.

Example of EMG decomposition of two adjacent segments using the proposed approrach in comparison with the reference decomposition. In these two segments a total of 7 sources are active. The numbers on top of the raw signal represent the source labels as identified by the automatic decomposition with the proposed method (top numbers) and the decomposition with interaction of an expert operator using EMGLAB (lower numbers). The labelling of sources in this example led to perfect matching with the reference result. The raw (solid line) and the reconstructed signal (dashed line) are shown in the upper panel whereas the residual error is plotted in the lower panel.
Fig. 4 shows an example of decomposition of simulated signals to better represent the ability of the method to identify complex superimpositions of action potentials. In this example, four overlapping action potentials are present in two segments. The shape of action potential #4, which is isolated in the second segment, is fully cancelled by overlaps of other action potentials in the first segment. Similarly, action potential #1 was relatively isolated in the first segment and cancelled in the second. Despite these complex overlaps, the automatic method was able to identify all action potentials in the two segments correctly. In this example, the reference decomposition result was provided by the simulation tool and is thus exact.
Fig. 4.

Illustration of decomposition result of one segment containing up to four overlapped action potentials and the neighboring segment with three overlapped action potentials. Upper labels represent the source numbers identified by the proposed automatic method while lower labels those from the simulation tool. The residual error is also shown in the lower panel.
The decomposition results for the experimental signals are shown in Tab. V. # Sources and # Val are respectively the number of sources identified by EMGLAB (reference results) and the number of validated spike trains according to the a-posteriori criterion on the regularity. Because the main challenge in the decomposition is dealing with overlapped action potentials[2], especially when more than two action potentials are superimposed, in Tab. V we also report the percentage of action potentials that are overlapped with others. Therefore, in Tab. V, % overlap and % overlap ≥3 indicates the percentage of overlapped action potentials (over the total number of action potentials) and the percentage of action potentials in superposition with at least other two action potentials (superposition of at least 3 action potentials), respectively. The algorithm runtime complexity was measured by computational time in seconds per iteration for the decomposition of each second of the experimental signal z. In order to decompose EMG signals of sufficient length (≈ 20 s to get reliable statistics) and upon several experimental signals, the Markov chain was systematically run for 200 iterations. The estimation of the discharge patterns was then obtained by a majority vote on each temporal window (of length = TR), whose advantages are discussed in [20].
Table V.
Comparison of decomposition results on the 5 experimental EMG signals (10%MVC, 20 s recordings).
| EMG # | 1 | 2 | 3 | 4 | 5 |
| # Sources | 5 | 5 | 8 | 8 | 4 |
| % overlap | 81 | 84 | 91 | 88 | 82 |
| % overlap ≥ 3 | 63 | 61 | 74 | 69 | 65 |
| MCMC on extended model | |||||
| # Val | 5 | 4 | 6 | 5 | 2 |
| A | 91.1% | 90.6% | 90.5% | 89.3% | 94.4% |
| Computing time (s.) | 13.2 | 14.9 | 15.2 | 13.8 | 15.0 |
| MCMC on uniform magnitude model | |||||
| # Val | 4 | 4 | 4 | 4 | 2 |
| A | 87.1% | 90.4% | 92.3% | 89.2% | 90.7% |
| Optimization using Tabu search [1] | |||||
| # Val | 3 | 4 | 4 | 4 | 2 |
| A | 89.4% | 85.1% | 87.7% | 87.2% | 92.5% |
The decomposition accuracy of the proposed method, as evaluated with the global performance index A, was improved (by approximately 3%) compared to that obtained by the joint maximization by Tabu search [1] (see Tab. V). Most importantly, more spike trains were validated with the proposed method than with the Tabu search. For all tested methods in Tab. V, the detection errors (both false positives and false negatives) occurred less often in segments with single action potentials, while most errors were found in segments with overlaps, as it was expected. Therefore, the accuracy of the method on identifying overlapped action potentials was also computed. Over the entire number of overlapped action potentials, the accuracy was 89% and over all action potentials in superimpositions of at least three action potentials, the accuracy was 85%. Note that by using the MCMC method, the decomposition results would not vary for the same signal even if the latter is analyzed several times with different initialization values. This convergence property (independent of initialization values) derives directly from the convergence in the distribution sense of the MCMC method (see discussion in Section IV).
Tab. V also shows the decomposition results obtained by the proposed MCMC algorithm with the constant spike magnitude model for each source, i.e., without including the variable amplitude model. The same expert results were used in each case and the “#Sources” row reports the number of detected sources. The decomposition performance degraded using this simplified model compared to the model with variable magnitudes: the latter have achieved better results in both extracting more valid trains and better accuracy calculated upon these valid trains.
The background noise variance estimation can also be considered a good indicator of decomposition quality, since it measures the difference between the observed signal and its reconstruction from the detected discharge patterns and the estimated spikes. Indeed, is sampled according to its conditional law IG(ᾱs, β̄s), where
and the mean value decreases as ||z− Σi si*hi||2 decreases.
Tab. VI shows from the preprocessing (shown as reference), after full decomposition with optimization by Tabu search [1] and with the proposed MCMC approach with and without spike magnitude variability. The lower value of residual noise level with the proposed approach (Tab. VI) is in agreement with the improvement of A by the MCMC method and the magnitude variability model that adjusts the energy for each detected spike. The lower error likely represents a better fit of the model w.r.t. the data rather than overfitting the noises since the reduction in residual error is also accompanied by superior accuracy, as shown in Tab. V.
TABLE VI.
Comparison of by optimization with Tabu search and by MCMC on the 5 experimental EMG signals (10% MVC, 20 s recordings).
| EMG # | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| preprocessing | 0.0012 | 0.0014 | 0.0012 | 0.0019 | 0.0011 |
| Tabu search | 0.0023 | 0.0029 | 0.0030 | 0.0034 | 0.0026 |
| MCMC (full model) | 0.0016 | 0.0027 | 0.0024 | 0.0030 | 0.0016 |
| MCMC (si = 1xi) | 0.0018 | 0.0027 | 0.0026 | 0.0033 | 0.0019 |
Finally, simulated signals with high variability in firing were used to evaluate the proposed decomposition method. One example of decomposition of simulated signals is presented in Fig. 4, as commented above. The average accuracy (over all motor units and over the 5 signals simulated) obtained for these signals was 83 ± 5%. The accuracy calculated for overlapped action potentials in the simulations was 80 ± 3%.
VI. Discussion and conclusion
We have proposed a novel method for fully automatic spike sorting in multiunit recordings. The main difficulty in the problem of spike sorting is the resolution of superimposed spikes. The isolated spikes can indeed be detected and clustered with robust techniques, that have high performance. On the contrary, the global optimization of overlapped action potentials is a nondeterministic polynomial-type (NP) hard problem, and thus cannot be solved by polynomial complexity algorithms. Therefore, methods for full spike sorting differ mainly for their performance when separating overlapped action potentials. We have previously proposed a method for the solution of overlapped spikes in neural or intramuscular recordings based on a Bayesian model coupled with a MAP estimator and the Tabu search technique [1]. In the present study, we have expanded the signal model to allow for a variability in the spike magnitudes in the same source. Moreover, we have proposed a new method for the solution of the spike sorting problem based on MCMC simulation. The convergence property of this method was proven theoretically (Appendix), whereas the Tabu search algorithm described in [1] is heuristic. The performance of this approach is further improved by including variable magnitudes in the spike model.
The model is based on the assumption of a refractory period in neural firing, which implies to set a minimum time lapse between two consecutive discharges of the same source. Further, the model also favors regular firings with respect to irregular firings, but without constraining the solution space to regular firings. Accordingly, the method was tested on simulated signals with very large firing variability and proved to be relatively accurate also in those conditions. As it was expected, the accuracy was lower in case of irregular than for regular firings but the method could still be successfully applied in a fully automatic way with accuracy greater than 80% for an ISI variability of 60% (simulation results). It has to be noted that the imposed variability in the simulations was so large that the spike train regularity could not be used as a relevant information for reducing the solution space in the automatic method. The model is also based on the assumption of independence of the spike trains. We note however that this assumption is not always met since neural cells often fire more synchronously than by mere chance. However, the spike train independence assumption should not be viewed as a limitation of the approach since it does not imply that dependent spike trains cannot be identified, similarly to the discussion above for regular firings. The assumption only implies that the potential correlation between firing patterns is not taken into account in the prior laws, thus the correlation property is simply not exploited by the model. Accordingly, the method was proved successful in decomposing motor unit activities in a hand muscle, characterized by a high degree of motor unit synchronization [32].
A limitation of the method is that, although it includes changes in amplitude, it does not track changes in the shapes of the action potentials, which often occur over time. Some previous methods (e.g., [33,34]) have included this possibility, at least for slow changes over time. Inclusion of slow changes in shape in the current approach could be incorporated in the first preprocessing phase in which the individual motor unit action potential shapes are estimated from segments containing only one potential. However, this extension has not been tested in the current study.
In conclusion, a new fully automatic method for spike sorting of multiunit recordings has been derived and compared to a previously proposed solution on experimental intramuscular recordings. The method was proven to provide good accuracy in signal decomposition with relatively limited computational time even in the case of several spikes overlapped in time.
Biographies

Di Ge received the B.S. degree in telecommunication from Jiaotong University, Shanghai, China, in 2003, the Diplôme d’Ingénieur from Ecole Centrale de Nantes, France, in 2006, and the Ph.D. degree in signal processing at the Institut de Recherche en Communications et Cybernétique de Nantes, UMR-CRNS 6597, France in 2009. He is currently a research consultant in Glaizer group. His research interests include Bayesian statistical inference and stochastic processes in solving inverse problems.

Eric Le Carpentier received the Ph.D. degree in automatic control from the Nantes University, Nantes, France, in 1990. Since 1992, he has been an Assistant Professor at Ecole Centrale de Nantes, Nantes. His current research interests include signal processing, stochastic simulation for estimation, detection, tracking, and control, with applications in biomedical signals, robotics, and precise geo-location.

Jérôme Idier was born in France in 1966. He received the diploma degree in electrical engineering from École Supérieure d’Électricité, Gif-sur-Yvette, France, in 1988 and the Ph.D. degree in physics from University of Paris-Sud, Orsay, France, in 1991.
Since 1991, he joined the Centre National de la Recherche Scientifique. He is currently a Senior Researcher at the Institut de Recherche en Communications et Cybernétique in Nantes. His major scientific interests are in probabilistic approaches to inverse problems for signal and image processing. He is serving as an Associate Editor for the IEEE Transactions on Signal Processing and for the Journal of Electronic Imaging, copublished by SPIE and IS&T.

Dario Farina (M’01–SM’09) obtained the MSc degree in Electronics Engineering from Politecnico di Torino, Torino, Italy, in 1998, and the PhD degrees in Automatic Control and Computer Science and in Electronics and Communications Engineering from the Ecole Centrale de Nantes, Nantes, France, and Politecnico di Torino, respectively, in 2002. In 2002–2004 he has been Research Assistant Professor at Politecnico di Torino and in 2004–2008 Associate Professor in Biomedical Engineering at Aalborg University, Aalborg, Denmark. From 2008 to 2010 he has been Full Professor in Motor Control and Biomedical Signal Processing and Head of the Research Group on Neural Engineering and Neurophysiology of Movement at Aalborg University. In 2010 he has been appointed Full Professor and Founding Chair of the Department of Neurorehabilitation Engineering at the University Medical Center Göttingen, Georg-August University, Germany, within the Bernstein Center for Computational Neuroscience. Since 2010 he is the Vice-President of the International Society of Electrophysiology and Kinesiology (ISEK) and a Fellow of the American Institute for Medical and Biological Engineering. He is the recipient of the 2010 IEEE Engineering in Medicine and Biology Society Early Career Achievement Award. He is an Associate Editor of Medical & Biological Engineering & Computing and member of the Editorial Boards of the Journal of Electromyography and Kinesiology and of the Journal of Neuroscience Methods. His research focuses on biomedical signal processing and modeling, neurorehabilitation, and neural control of movement. Within these areas, he has (co)-authored approximately 200 papers in peer-reviewed Journals and about 300 among conference papers/abstracts, book chapters and encyclopedia contributions. He is an Associate Editor of IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING.
Appendix
Proof
To show the irreducibility of the chain in Tab. I, it is sufficient to show that for all u ∈
, such that P(u) > 0, the probability of a particular trajectory composed of {u(0) = 0, …, u(i), … u(L) = u}, where L = |u|1 and |u(i) – u(i−1)|1 = 1, is non-zero.
Such a chain is constructed by adding a spike of a certain source in each iteration. It is then sufficient to show that for all i, K(u(i−1) ↦ u(i)) > 0, or equivalently,
| (A-1) |
It is evident that u(i) ∈ ω(u(i−1)), and it follows that:
The inequality (A-1) is thus guaranteed by the fact that P(u(i)) > 0 for all i. Since P(u) > 0 implies that P(u(i)) > 0 for all i (u ∈
⇒ u(i) ∈
for all i).
Footnotes
The superscript (k) and (−k) denote parameters in the k-th segment and parameters in all other segments, respectively.
References
- 1.Ge D, Le Carpentier E, Farina D. Unsupervised Bayesian Decomposition of Multi-Unit EMG Recordings using Tabu Search. IEEE Trans Biomed Eng. 2010 Mar;57(3):561–517. doi: 10.1109/TBME.2009.2022277. [DOI] [PubMed] [Google Scholar]
- 2.Lewicki MS. A review of methods for spike sorting: the detection and classification of neural action potentials. Network: Computation in Neural Systems. 1998;9(4):R53–R78. [PubMed] [Google Scholar]
- 3.Quian Quiroga R, Nadasdy Z, Ben-Shaul Y. Unsupervised spike detection and sorting with wavelets and superparamagnetic clustering. Neural Computation. 2004;16:1661–1687. doi: 10.1162/089976604774201631. [DOI] [PubMed] [Google Scholar]
- 4.Lewicki MS. Bayesian modeling and classification of neural signals. Neural Computation. 1994;6:1005–1030. [Google Scholar]
- 5.Bankman I, Johnson K, Schneider W. Optimal detection, classification, and superposition resolution in neural waveform recordings. IEEE Trans Biomed Eng. 1993 Aug;8(40):836–841. doi: 10.1109/10.238472. [DOI] [PubMed] [Google Scholar]
- 6.Chandra R, Optican L. Detection, classification, and superposition resolution of action potentials in multiunit single-channel recordings by an on-line real-time neural network. IEEE Trans Biomed Eng. 1997 Aug;44:403–412. doi: 10.1109/10.568916. [DOI] [PubMed] [Google Scholar]
- 7.Atiya FA. Recognition of multiunit neural signals. IEEE Trans Biomed Eng. 1992 Jul;39:723–729. doi: 10.1109/10.142647. [DOI] [PubMed] [Google Scholar]
- 8.McGill KC. Optimal resolution of superimposed action potentials. IEEE Trans Biomed Eng. 2002 Jul;49(7):640–650. doi: 10.1109/TBME.2002.1010847. [DOI] [PubMed] [Google Scholar]
- 9.McGill KC, Lateva ZC, Marateb HR. EMGLAB: An interactive EMG decomposition program. J Neurosci Methods. 2005 Dec;149(2):121–133. doi: 10.1016/j.jneumeth.2005.05.015. [DOI] [PubMed] [Google Scholar]
- 10.Takahashi S, Anzai Y, Sakurai Y. Automatic sorting for multineuronal activity recorded with tetrodes in the presence of overlapping spikes. J Neurophysiol. 2003;89:2245–2258. doi: 10.1152/jn.00827.2002. [DOI] [PubMed] [Google Scholar]
- 11.Takahashi S, Sakurai Y. Real-time and automatic sorting of multi-neuronal activity for sub-millisecond interactions in vivo. Neuroscience. 2005;134(1):301– 315. doi: 10.1016/j.neuroscience.2005.03.031. [DOI] [PubMed] [Google Scholar]
- 12.Takahashi S, Sakurai Y, Tsukada M, Anzai Y. Classification of neuronal activities from tetrode recordings using independent component analysis. Neurocomputing. 2002;49(10):289–298. [Google Scholar]
- 13.Holobar A, Zazula D. Correlation-based decomposition of surface electromyograms at low contraction forces. Med biol eng comput. 2004;42(4):487–495. doi: 10.1007/BF02350989. [DOI] [PubMed] [Google Scholar]
- 14.Holobar A, Farina D, Gazzonib M, Merlettib R, Zazula D. Estimating motor unit discharge patterns from high-density surface electromyogram. Clin neurophysiol. 2009;120:551–562. doi: 10.1016/j.clinph.2008.10.160. [DOI] [PubMed] [Google Scholar]
- 15.Farina D, Falla D. Effect of muscle-fiber velocity recovery function on motor unit action potential properties in voluntary contractions. Muscle and nerve. 2008 May;37(5):650–658. doi: 10.1002/mus.20948. [DOI] [PubMed] [Google Scholar]
- 16.Kormylo JJ, Mendel JM. Maximum-likelihood seismic deconvolution. IEEE Trans on Geoscience and Remote sensing. 1983 Jan;GE-21(1):72–82. [Google Scholar]
- 17.Cheng Q, Chen R, Li TH. Simultaneous wavelet estimation and deconvolution of reflection seismic signals. IEEE Trans on Geoscience and Remote sensing. 1996 Mar;34:377–384. [Google Scholar]
- 18.Champagnat F, Goussard Y, Idier J. Unsupervised deconvolution of sparse spike trains using stochastic approximation. IEEE Trans on Signal Processing. 1996 Dec;44(12):2988–2998. [Google Scholar]
- 19.Bourguignon S, Carfantan H. Bernoulli-Gaussian spectral analysis of unevenly spaced astrophysical data. IEEE Workshop Stat. Sig. Proc.; Bordeaux, France. July 2005; pp. 811–816. [Google Scholar]
- 20.Kail G, Novak C, Hofer B, Hlawatsch F. ICASSP. Taipei, Taiwan, R.O.C: Apr, 2009. A blind Monte Carlo detection-estimation method for optical coherence tomography; pp. 493–496. [Google Scholar]
- 21.McGill KC, Cummins KL, Dorfman LJ. Automatic decomposition of the clinical electromyogram. IEEE Trans Biomed Eng. 1985 Jul;BME-32(7):470–477. doi: 10.1109/TBME.1985.325562. [DOI] [PubMed] [Google Scholar]
- 22.McGill KC, Dorfman LJ. High-resolution alignment of sampled waveforms. IEEE Trans Biomed Eng. 1984 Jun;BME-31(6):462–468. doi: 10.1109/TBME.1984.325413. [DOI] [PubMed] [Google Scholar]
- 23.Wood F, Black MJ. A nonparametric bayesian alternative to spike sorting. J Neurosci Methods. 2008;173(1):1–12. doi: 10.1016/j.jneumeth.2008.04.030. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Ge D. PhD thesis. Dec, 2009. Déconvolution impulsionnelle multi-source. Application aux signaux électromyographiques. Ecole centrale de Nantes, 1 rue de la Noë. [Google Scholar]
- 25.Green PJ. Reversible jump MCMC computation and Bayesian model determinaion. Biometrika. 1995;82:711–732. [Google Scholar]
- 26.Robert CP, Casella G. Springer Texts in Statistics. Springer Verlag; New York, NY, USA: 2004. Monte Carlo Statistical Methods. deuxieme edition. [Google Scholar]
- 27.Tierney L. Markov Chains for Exploring Posterior Distributions. Ann Statist. 1994;22(4):1701–1728. [Google Scholar]
- 28.Farina D, Crosetti A, Merletti R. A model for the generation of synthetic intramuscular EMG signals to test decomposition algorithms. IEEE Trans Biomed Eng. 2001;48:66–77. doi: 10.1109/10.900250. [DOI] [PubMed] [Google Scholar]
- 29.Luca CJD, Adam A, Wotiz R, Gilmore LD, Nawab SH. Decomposition of Surface EMG Signals. J Neurophysiol. 2006 May;96:1646–1657. doi: 10.1152/jn.00009.2006. [DOI] [PubMed] [Google Scholar]
- 30.Moritz CT, Barry BK, Pascoe MA, Enoka RM. Discharge Rate Variability Influences the Variation in Force Fluctuations Across the Working Range of a Hand Muscle. J Neurophysiol. 2005 May;93(5):2449–2459. doi: 10.1152/jn.01122.2004. [DOI] [PubMed] [Google Scholar]
- 31.Fuglevand AJ, Winter DA, Patla AE. Models of recruitment and rate coding organization in motor-unit pools. J Neurophysiol. 1993 Dec;70(6):2470–2488. doi: 10.1152/jn.1993.70.6.2470. [DOI] [PubMed] [Google Scholar]
- 32.Dideriksen JL, Falla D, Baekgaard M, Mogensen ML, Steimle KL, Farina D. Comparison between the degree of motor unit short-term synchronization and recurrence quantification analysis of the surface EMG in two human muscles. Clin Neurophysiol. 2009 May;120(12):2086–2092. doi: 10.1016/j.clinph.2009.09.011. [DOI] [PubMed] [Google Scholar]
- 33.LeFever R, De Luca C. A procedure for decomposing the myoelectric signal into its constituent action potentials-part I: technique, theory, and implementation. IEEE Trans Biomed Eng. 1982;29:149–157. doi: 10.1109/tbme.1982.324881. [DOI] [PubMed] [Google Scholar]
- 34.Studer RM, De Figueiredo RJP, Moschytz GS. An Algorithm for Sequential Signal Estimation and System Identification for EMG Signals. IEEE Trans Biomed Eng. 1984;31(3):285–295. doi: 10.1109/TBME.1984.325267. [DOI] [PubMed] [Google Scholar]

(m, Σ),