Deep Spike Decoder (DSD)

1 INTRODUCTION . Spike sorting focuses on analyzing electrophysiological data , detecting occurrences of action potentials , and assigning them to distinct neurons . The resulting spikes-based representation is regarded as a complete , high-resolution , noise-free , and disentangled representation of the underlying neural activity . Spike sorting has been studied extensively for use with extracellular electrode ( reviewed by Rey et al . 2015 ; Carlson & Carin 2019 ; Hennig et al . 2019 ) and surface electromyography ( sEMG ; Farina et al . 2004 ; Holobar & Zazula 2007 ; Negro et al . 2016 ) . In this paper , we propose a novel solution to the spike sorting problem that marries biophysical inductive biases and constraints with the power of self-supervision . Our approach uses a deep autoencoder architecture where the encoder functions as spike sorter and the decoder implements a generative model . The entire model is trained end-to-end in a completely self-supervised fashion by leveraging a set of loss terms that enforce biophysically-motivated priors . In this paper , the proposed approach evaluated using both real-world and realistically simulated sEMG datasets . The results demonstrate the validity of our approach and motivate further development of the overall paradigm of unsupervised deep spike sorting . 2 PROBLEM FORMULATION . Here , we briefly discuss the problem formulation , and generative model giving rise to the measured sEMG signal ( Merletti & Farina , 2016 ) . A motor neuron innervates a set of muscle fibers , and together they are referred to as a motor unit ( MU ) . As an MU emits a spike , denoted by the variable s , it passes through layers of connective tissue , blood , and skin , before being picked up by the electrodes on the surface . This pattern is referred to as the motor-unit-action-potential , ( MUAP ) . The received sEMG signal at the electrode , is the result of an MU spike being convolved with a kernel , given by the tissue between the m ’ th MU and the e ’ th electrode , he , m . The result of this convolution is the MUAP-waveform , which - since the spike is binary - is also the shape of the convolution kernel . The kernel shape is directly and physically related to the space between the MU and the electrode . As other spikes from the same MU are transmitted , they are also convolved with the same kernel he , m on the way to the electrode . Therefore , the signal that the e ’ th electrode sees due to the m ’ th MU ’ s spike train sm [ t ] , is the convolution of the two entities , given by : xe [ t ] = L−1∑ l=0 he , m [ l ] sm [ t− l ] + ne [ t ] ( 1 ) where ne [ t ] is the thermal noise at the e ’ th electrode . Of course , there are more than one MUs - in fact there are M of them , so the total result of what the e ’ th electrode sees is a sum of all their effects , and so we have : xe [ t ] = M−1∑ m=0 L−1∑ l=0 he , m [ l ] sm [ t− l ] + ne [ t ] ( 2 ) 3 METHOD . The spike sorting problem can be cast as an unsupervised representation learning problem ( Goodfellow et al. , 2016 ; Bengio et al. , 2013 ) , where the multi-channel sEMG signal is represented as individual MU spike trains and the corresponding MUAP spatiotemporal waveforms . Here , we tackle this problem using a deep autoencoder where the encoder extracts spike pulse trains and the decoder reconstructs the sEMG signal according to the biophysics of the problem . This network is then trained using loss terms that enforce the reconstruction of the sEMG signal , the sparsity of the spike trains , and the parsimony of the MUAPs , the uniqueness of motor units , and the refractory period of motor neurons . 3.1 MODEL ARCHITECTURE . The DSD model can be put into the following form where Equations 3 and 4 represent the encoder and the decoder parts correspondingly . The encoder fe ( . ) takes in the sEMG data x ∈ RExT where E is the number of electrodes and T is the number of timesteps , and the encoder weights we , to infer the spike probabilities ŝ ∈ RNxT where N is the maximum number of MUs the network is allowed learn . In this representation , individual MU spike probabilities are inferred for all MUs for all timesteps . ŝ = fe ( x ; we ) ( 3 ) x̂ = fd ( ŝ ; wd ) ( 4 ) The decoder fd ( . ) then takes in the inferred MU spike probabilities ŝ and infer the reconstructed sEMG signal x̂ using the decoder weights wd . Since the decoder mimics the biophysical model closely , we can recover the MUAP waveforms corresponding to each MU from the decoder weights wd . Here , the encoder model corresponds to the learned deep spike sorter and the decoder model corresponds to the learned biophysical model . During inference time , we typically run only the learned encoder for spike sorting purposes . DSD Encoder The encoder function fe ( . ) constitutes a deep convolutional neural network ( CNN ) which is tasked with solving the spike sorting problem . While traditional spike sorting approaches first identify peaks and then cluster them into motor units , our deep spike sorter solves both problems simultaneously in a data-driven manner . The encoder is implemented as a segmentation network followed by a classifier head . The segmentation network takes in the sEMG data x ∈ RExT and encodes it in a latent space of size ( L , E , T ) where L is the dimensionality of the latent space . The classifier head then takes in this latent representation and calculates spike scores using a linear classifier , with input size ( L , E ) , for each motor unit that runs through each timestep , which are then passed through a Gumbel-softmax function ( Jang et al. , 2016 ) for spike binarization . We have two variants of the DSD model based on the segmentation network used . In one variant , we use a densely connected neural network architecture ( i.e . DenseNets ) similar to Huang et al . ( 2017 ) . The other variant utilizes skip connections between dense blocks and is based on the one hundred layer tiramisu architecture ( Jégou et al. , 2017 ) . DSD Decoder The decoder function fd ( . ) is strictly a linear model that mimics the convolutive multi-channel sEMG mixing model . This biophysical model , described in detail by Merletti & Farina ( 2016 ) , can be described as a single convolution operation where the convolutional kernels are the spatiotemporal waveforms corresponding to each motor unit action potential ( MUAP ) . Using this biophysical model helps us constrain the problem such that , together with the training losses , it coincides with the spike sorting problem . And the interpretability of it allows us to easily recover the MUAP waveforms corresponding to each MU . In our implementation , we used the canonical tensor decomposition trick ( Kolda & Bader , 2009 ; Hitchcock , 1927 ) , alongside the spatial and the temporal dimensions to significantly reduce the number of learned parameters while maintaining the expressive power necessary to span the space of possible MUAP waveforms . 3.2 TRAINING LOSSES . Reconstruction Loss The reconstruction loss is given in Equation 5 . It penalizes for the L4 norm of the reconstruction error . Lreconstruction = ‖x− x̂‖4 ( 5 ) Sparsity Loss MU spikes can be rare events relative to typical sampling rates of sEMG devices . We use the L1 norm of the spike probabilities to enforce this prior knowledge , as shown in Equation 6 . Lsparsity = ‖ŝ‖1 ( 6 ) Parsimony Loss One of the main challenges in using a deep autoencoder for spike sorting is the cardinality problem . Since we do not know the exact number of motor units , we overparameterize the network based on an upper limit . Then , by penalizing for the proposal of new MUAP waveforms , we are able to force the network to be parsimonious with respect to the set of MUAP proposals it uses to explain a given sEMG signal . We use the L1-L2 norm to enforce this group sparsity as in Bach et al . ( 2012 ) . Lparsimony = ∑ g∈G ∥∥∥∥∂wgd∂t ∥∥∥∥ 2 ( 7 ) Equation 7 describes the parsimony loss . The partitioning for L1-L2 norm is defined such that each partition , g ∈ G , corresponds to a tensor wgd that describes the local spatiotemporal waveform around a neighborhood of electrodes for a particular MU . This forces the network to minimize both the number of MUAPs and their spatial footprints . Also note that we apply this loss not directly on the spatiotemporal waveforms , but rather on their first derivatives with respect to time , in order to enforce temporal smoothness . Uniqueness Loss The uniqueness loss forces the MUAP waveform proposals to focus on explaining different phenomena . It implements a joint prior on the set of MUAP waveforms and their corresponding MU spike trains . This is done by penalizing for the joint occurrence of the temporal similarity between MU spike trains and the spatial similarity between their MUAP waveforms . Luniqueness = ∥∥vec ( ( s̃s̃T ) ( mmT ) ( J − I ) ) ∥∥ 1 ( 8 ) In Equation 8 , the terms s̃ and m correspond to a dilated version of the spike trains and the spatial energy distribution of the MUAP waveforms . The matrices J and I correspond to an all-ones matrix and an identity matrix respectively . The operators vec ( . ) and correspond to vectorization operation and the hadamard element-wise product . Refractory Period Loss Refractory period of motor units describe the amount of time needed between two spikes from a single motor unit . The refractory period loss encodes this prior knowledge by penalizing for multiple spike occurences from a single MU within its time window . It can be implemented efficiently as in Equation 9 . Lrefractory = ‖ReLU ( sumpool ( s ) − 1 ) ‖1 ( 9 ) Total Loss The total loss is a combination of the above loss items as shown in Equation 10 where α , β , γ , and η are hyper-parameters to be tuned . Ltotal = Lreconstruction + αLsparsity + βLparsimony + γLuniqueness + ηLrefractory ( 10 ) 4 RESULTS . 4.1 EVALUATION WITH REAL-WORLD DATA . We first evaluate the DSD algorithm on real sEMG data acquired from 16 differential sensors worn around the circumference of the arm . The sEMG data recorded is shown in Figure 1 . In this case , the human user was instructed to generate two separate activity modes , corresponding to a slight ( imperceptible ) tensing of muscles , first of the index finger and then of the small finger . Because our sEMG datasets lack simultaneously recorded intramuscular EMG to serve as ground truth signals ( Negro et al. , 2016 ) , this evaluation is limited to unsupervised analyses . Its subsequent blind factorization by the DSD is shown in Figure 2 . We can clearly see the following facets : MUAPs are spatially localized with a clear spatial peak and fall-off . Their smoothness and time-profiles look reasonable , as expected for differential recordings , and the MUAPs look like they roughly factorize the data . Furthermore , their corresponding spike-trains also seem to spike at the appropriate peak locations . Lastly , the cardinality of the spike-trains/MUAPs looks reasonable as well , in this case parsimoniously explaining the dataset using two unique waveforms . The zoomed in versions of both results are shown for the orange and green waveforms in Figure 3 . On the right hand side , we can see the reconstruction errors more saliently , and on the left hand side , we can see some missed detections corresponding to what look like low amplitude spikes .

Summary: This paper describes a machine learning model for learning spiking representations from EMG (electromyography) like data. The basic model is an autoencoder, where the bottleneck layer is designed to project the waveform inputs into "spike" representations. Specifically, there is a DSD (Deep Spike Decoder) encoder and decoder, where the encoder is implemented as either a DenseNet[1]-like or Tiramisu[2]-like architecture. The bottleneck seems to be implemented by a linear layer binarized with a Gumbel-Softmax activation. The decoder is a linear layer. Several losses are considered, including a L4-norm (!), a sparsity loss, a parsimony loss, a uniqueness loss, and a refractory period loss. The model is validated qualitatively on real EMGs, and quantitatively on synthetic data.