Abstract
Objective:
Epidural electrical stimulation (EES) has emerged as an approach to restore motor function following spinal cord injury (SCI). However, identifying optimal EES parameters presents a significant challenge due to the complex and stochastic nature of muscle control and the combinatorial explosion of possible parameter configurations. Here, we describe a machine-learning approach that leverages modern deep neural networks to learn bidirectional mappings between the space of permissible EES parameters and target motor outputs.
Approach:
We collected data from four sheep implanted with two 24-contact EES electrode arrays on the lumbosacral spinal cord. Muscle activity was recorded from four bilateral hindlimb electromyography (EMG) sensors. We introduce a general learning framework to identify EES parameters capable of generating desired patterns of EMG activity. Specifically, we first amortize spinal sensorimotor computations in a forward neural network model that learns to predict motor outputs based on EES parameters. Then, we employ a second neural network as an inverse model, which reuses the amortized knowledge learned by the forward model to guide the selection of EES parameters.
Main results:
We found that neural networks can functionally approximate spinal sensorimotor computations by accurately predicting EMG outputs based on EES parameters. The generalization capability of the forward model critically benefited our inverse model. We successfully identified novel EES parameters, in under 20 minutes, capable of producing desired target EMG recruitment during in vivo testing. Furthermore, we discovered potential functional redundancies within the spinal sensorimotor networks by identifying unique EES parameters that result in similar motor outcomes. Together, these results suggest that our framework is well-suited to probe spinal circuitry and control muscle recruitment in a completely data-driven manner.
Significance:
We successfully identify novel EES parameters within minutes, capable of producing desired EMG recruitment. Our approach is data-driven, subject-agnostic, automated, and orders of magnitude faster than manual approaches.
1. Introduction
Damage to the central nervous system can lead to the chronic impairment of motor, sensory, and autonomic function [1, 2]. However, recent advances within the field of therapeutic electrical neuromodulation have demonstrated restoration of a wide range of capabilities, including the ability to voluntarily control muscles after chronic, motor complete spinal cord injury (SCI) [3]. Specifically, epidural electrical stimulation (EES), wherein an electrode array is implanted in the epidural space below the SCI lesion site (Fig. 1a), has been shown to support walking, standing, cycling, and swimming years after severe SCI [4–12]. Evidence from computational models [13–15] and experimental studies [16–18] suggest that EES primarily recruits large-diameter, afferent fibers at their entrance to the spinal cord through dorsal root activation, which engages spinal reflex circuitry resulting in activation of interneuronal circuits and projecting motor neurons [19]. However, evoking motor activity in vivo is a complex, multi-faceted process. Factors including the anatomy of the spinal cord, the placement of electrodes, the extent of the spinal injury, EES-supported plasticity, and the current functional state of the spinal circuits orchestrate spinal neural activity and motor outputs that are highly dynamic and non-linear. According to a recent survey of SCI physicians, the lack of closed-form solutions or clear “guidelines” outlining stimulation parameters with deterministic effects has become one of the main barriers for the clinical translation of EES [20]. Therefore, there is a need to develop robust and systematic algorithms to automatically identify EES parameters that drive sensorimotor networks to aid in the restoration of motor function.
Figure 1: Goal:

To automatically determine optimal Epidural Electrical Stimulation (EES) parameters (θ) that yield target sensorimotor network activation (x). (a) EES is thought to primarily recruit large-diameter, afferent fibers at their entrance to the spinal cord through dorsal roots when stimulation is delivered at motor threshold. (b) Using mechanistic models to study the transformation of EES into motor outputs such as those measured by Electromyography (EMG), referred to here as the forward problem, impedes the rapid discovery of solutions to the more general inverse problem (c). We propose to leverage recent progress in deep learning to amortize the cost of simulating spinal sensorimotor computations via a universal function approximator fϕ, which can subsequently be reused by another neural network fψ for solving our problem of interest.
The current strategy for determining patient-specific sensorimotor responses to EES, here defined as the EES evoked transynaptic activation of motor neurons via a subset of sensory fibers, is to construct a detailed associative map documenting the spatiotemporal patterns of electromyographic (EMG) activations [5, 7, 18, 21]. EES pulses are applied at varying amplitudes while the subject is at rest and the corresponding muscle responses are recorded to compute recruitment curves. This associative map is subsequently used to construct EES protocols to drive targeted muscle recruitment in more complex tasks such as standing or stepping. There are, however, two primary limitations with this approach. First, relying on associative maps implicitly assumes a deterministic relationship between EES and sensorimotor network activation. Yet, the inverse problem of identifying EES parameters that produce specific patterns of muscle activity is complex, under-constrained and stochastic (Fig. 1). Second, the recruitment-curve based approach for building an atlas of EMG activations generally overlooks covariances, or inter-dependencies, between EES parameters and muscle outputs. Deriving recruitment curves requires many repeated stimulation episodes, which further limits the number of muscle response combinations that can be tested. For this reason, the standard practice in the field is to rely on recruitment curves derived by varying stimulation amplitude alone. However, such measurements do not account for the signal variance incurred by jointly manipulating stimulation amplitudes along with other EES parameters, such as the frequency and location of the stimulation. Given the highly non-linear nature of EMG responses to EES (Fig. 2c), simple interpolation using recruitment curves may lead to erroneous or sub-optimal EES identification.
Figure 2: Measuring motor outputs evoked by epidural spinal stimulation.

(a) Intra-operative X-Ray image of the implanted electrode arrays in L3-6. (b) Experimental setup for data acquisition in sheep. Spinal stimulation (μ ∈ [10, 100]Hz, a ∈ [60, 1500]μA) was delivered for 300ms at the start of each trial. Here, we show a sample trial stimulating a Caudal electrode with μ = 100Hz, a = 420μA. Motor output is measured by both electromyography (EMG) and kinematics as given by the Hip, Hock and Hoof positions. (c-d) Evoked EMG responses measured upon systematic changes to EES frequency and amplitude respectively reveal the nonlinearities of spinal sensorimotor computations. EES onset is indicated by gray dashed lines.
To address these issues, we adopt a system identification perspective [22] and cast the inverse problem of computing optimal EES parameters, for targeted activation of sensorimotor networks, as probabilistic inference (Fig. 1). Conceptually, the idea is to treat EES parameters θ, and EMG activity x as specified by a joint probability model p(θ, x), in order to estimate the posterior density p(θ|x) via Bayes’ theorem:
| (1) |
where p(θ) is a suitable prior over EES parameters, p(x|θ) is the “likelihood” of observing x under a certain set of EES parameters θ, and p(x), known as the evidence, signifies the probability of observing an EMG pattern x. The mathematical object p(θ|x) is traditionally a probability density function from which one can draw samples, for example via Markov Chain Monte Carlo (MCMC) [23]. This formulation naturally avoids the aforementioned caveat of determinism. Moreover, for a specific EMG observation x0, EES parameter values sampled from the conditional distribution p(θ|x = x0) will reflect the inherent trade-offs between the different components of θ (the frequency and amplitude of EES and the stimulation location), thus alleviating the covariance bottleneck.
Traditionally, mechanistic models are used as forward models to compute sensorimotor network activation in response to EES. One challenge with such statistical inference formulation has traditionally been the requirement that the class of mechanistic models under consideration has to be restricted to those with analytical likelihood functions because sampling algorithms such as MCMC rely on the evaluation of the likelihood p(x|θ) to sample from the posterior density. This severely restricts the class of models that can be considered and hence the generality of the approach. However, recent innovations in Approximate Bayesian Inference methods alleviate this problem making it possible to perform posterior inference from simulation models without explicit analytical access to p(x|θ) [24–26], thus permitting the inclusion of arbitrary forward models. However, despite these improvements, the practical cost of constructing, tuning, and simulating data from mechanistic models of spinal sensorimotor circuits remains prohibitively high, both from a time and human-effort standpoint.
To facilitate the rapid inference of EES parameters, we reformulate the standard inference to take advantage of recent advances in deep learning. Specifically, we propose to functionally approximate the computations of spinal sensorimotor circuits using a deep neural network fϕ (function f parameterized by weights ϕ) that map EES parameters onto corresponding EMG outputs. EMG signals were selected as the model output as they have traditionally been used to guide EES parameter optimization [4, 7]. We refer to fϕ as our “forward model” (Fig. 1b). Training fϕ once, effectively amortizes the cost of simulating spinal computations, which can then be efficiently reused for inference. Because of the embarrassingly parallel nature of deep neural networks coupled with hardware specializations, simulating EES-evoked sensorimotor activity data can be done exponentially faster than simulating mechanistic biophysical models. Additionally, end-to-end data-driven automation avoids the heuristics and biases that arise from manual interventions.
By training our forward model from data, the traditionally more challenging inverse problem of estimating EES parameters given data becomes tractable (Fig. 1c) for the following reason. Our amortized forward model fϕ serves as a close approximation of the data generating process underlying sensorimotor network activation following EES. Thus, it now suffices to compute posterior densities over the inputs to the forward model fϕ as opposed to parameters of mechanistic models such as muscle spindle feedback circuits (as in [27] for instance). Drawing from the recent successes of neural density estimators for simulation-based inference [24–26, 28–30], we define our “inverse” model fψ to be an invertible conditional flow, a special formulation of a neural network that learns the posterior over the EES parameters from data simulated using the forward model fϕ (Fig. 1c). The main source of biological stochasticity that we are addressing is the evaluation of EES evoked responses in the unloaded state due to factors such as differences in spinal cord anatomy and electrode placement that require individualized optimization of EES parameters. Although further optimization may be required in the contexts of active tasks that may increase stochasticity due to increased somatosensory input, the data presented here provides a methodology to evaluate EES to muscle activation mappings.
In summary, we introduce a general data-driven machine learning approach to automatically identify optimal EES parameters and produce desired target patterns of sensorimotor network and lower extremity musculature activations. To the best of our knowledge, our formulation is the first to cast the problem of spinal EES identification in a probabilistic framework. Our simulation-based inference solution to motor control is fast, only requiring a minimal compute infrastructure. We validate its utility through both extensive offline, as well as in vivo evaluations in sheep. Our approach provides a solution to the lack of systematic parameter selection that exists as a barrier to the clinical translation of EES. We make our code publicly available at https://github.com/serre-lab/ees-inference.
2. Materials and Methods
2.1. Study subjects
All study procedures were conducted with the approval of the Brown University Institutional Animal Care and Use Committee (IACUC) and in accordance with the National Institutes of Health Guidelines for Animal Research (Guide for the Care and Use of Laboratory Animals). Four sheep (two female, two male) in the age range one to four years and weighing 83.43±7.58 kg were used for this study. Animals were kept in separate cages in a controlled environment on a 12-h light/dark cycle with ad libitum access to water, and were fed twice daily. Briefly, the sheep underwent laminectomy procedures to surgically implant two 24-contact EES electrode arrays (Micro-Leads Medical, Somerville, MA) placed onto the dorsal aspect of the epidural space of the lumbosacral spinal cord, spanning approximately the L4-L6 vertebral bodies [31]. Additionally, a ground wire and a reference wire were placed into the epidural space and paraspinal musculature, respectively. The sheep were allowed at least two weeks of recovery time prior to experimentation.
2.2. Data acquisition
Muscle activity was measured via surface electromyography (EMG) from four bilateral lower extremity muscles: biceps femoris (BF), gracilis (GR), peroneus longus (PL), and gastrocnemius (GA). The EMG sensors (Trigno Avanti model, Delsys Inc., Natick, MA) were placed longitudinally along the muscle belly following preparation of the attachment site via shaving and cleaning. These muscles were selected based on our previous experience collecting surface EMG in the sheep model [31]. BF is a proximal muscle responsible for hock flexion and hip extension, and GR is a proximal muscle responsible for hip abduction, hock flexion, and hock internal rotation. PL is a distal muscle responsible for hock flexion and GA is a distal muscle responsible for hock extension. During the experimental procedure, the animals were conscious and they were raised in a support sling (Panepinto, Fort Collins, CO, USA) until clearance between the ground and their hooves was observed. Stimulation was delivered via a Grapevine Macro+Stim or Nano2+Stim front end (Ripple Neuro, Salt Lake City, UT), and the accompanying Trellis software package. Custom code was written in MATLAB R2020a (The MathWorks Inc., Natick, MA, USA) to deliver a randomized set of stimulation values that varied in both stimulation amplitude and stimulation frequency. 300 ms long trains of stimulation pulses were delivered every 1 second. The stimulation pulse waveform was a charge-balanced, cathode-leading, biphasic square wave with a 1:3 aspect ratio and 167 μs pulse width. Stimulation was delivered in a monopolar configuration, with 1 electrode serving as the cathode and a stainless steel ground electrode serving as the return path/anode. Each stimulation train had amplitude and pulse frequency drawn randomly from a set of predefined ranges (60 μA - 1500 μA amplitude, 10 – 100 Hz frequency). The maximum stimulation amplitude was determined prior to each recording by manually increasing amplitude until the sheep could not tolerate the stimulation as indicated by a visual negative response to stimulation, or the maximum set tolerance of 1500 μA was reached [31]. 18 stimulation electrodes were chosen across the electrode arrays to acquire EMG responses at various anatomical regions including multiple spinal segments along the rostral-caudal axis. Additionally the location was varied along the medial-lateral axis to target bilateral, left, and right muscle activation. EMG signals from each muscle were bandpass filtered (20 – 450 Hz, second order Butterworth) and digitized (16-bit resolution, 2148 Hz sampling rate) on the sensor before streaming wirelessly to a base station connected to a PC. The dataset used for the neural network analysis consisted of a mixture of sub- and supra-threshold EMG samples, here defined as an observable EMG signal following data processing. Representative bilateral EMG responses to EES are shown in Appendix A (Fig. 8). As shown in Fig. 8, application of disparate stimulation parameters can selectively activate different sets of hindlimb muscles, and similar sets of stimulation parameters can have significantly different effects when applied at different electrode contacts, indicating the complex interactions between EES and muscle recruitment. Additionally, synchronized video recordings of hind limb motion were obtained from three sRGB cameras (Blackfly S, Teledyne FLIR LLC, Wilsonville, OR). Hind limb kinematics were obtained offline from these videos using state-of-the-art computer vision techniques. For more details, we refer the reader to Appendix B.
2.3. Data handling
EMG preprocessing
EMG waveforms were epoched from −100 ms prior to stimulation to 300 ms after each stimulation train. Raw values were downsampled to 2000 Hz and digitally high-pass filtered with 100 Hz cutoff (two-pole acausal Butterworth filter) to reduce any noise outside the frequency spectrum of interest that may have been caused by issues such as movement artifacts. EMG envelopes were calculated by taking the absolute value of the raw waveforms and applying a 2 pole acausal Butterworth low-pass filter with a corner frequency of 40 Hz.
Outlier removal
EMG data recorded from awake and alert animals included incidental factors, such as movement artifacts (especially during unprompted voluntary movements by the animal), unrelated to the electrical stimulation. We computed an internal consistency metric to aid in the removal of gross outliers. EMG envelopes, grouped by trial condition, were epoched into 100 ms windows. We calculated the sample covariance for each window and compared the maximum observed Mahalanobis distance to the 99.999% confidence interval of the corresponding chi-squared distribution. Trials with at least one window violating this confidence interval were flagged as outliers and excluded from subsequent analysis. Generally, this heuristic was very strict and led to the rejection of 5% – 10% of the data (confirmed as anomalous upon visual inspection).
Unreliable samples removal
To promote the discovery of repeatable associations between EES parameters and EMG, we calculated a “reliability” score for each EMG response, quantifying the degree to which the signal remains stable with repeated presentation of identical stimulation parameters. Sources of trial-to-trial variability included sensor noise, animal motion, and biological stochasticity. For each stimulation configuration θj, we computed its reliability coefficient using a bootstrapping procedure as:
| (2) |
where for configuration θj and bootstrap round b we split EMG responses from repeats of this stimulation into two random halves, whose mean responses are and . We deemed trials for which as unreliable and discarded them from subsequent analysis. In our experiments, we set Nb = 100 and ξthresh = 0.4, which was approximately the median data reliability measure. Furthermore, if the majority of the trials for a given EMG sensor were deemed unreliable or the EMG sensor became dislodged due to animal movement, that sensor was not used in subsequent analysis. If more than one EMG sensor on each leg was deemed unreliable, data from that experiment was not used for analysis.
Subthreshold EMG removal
We defined sub-threshold EMG samples as trials where the stimulation was insufficient to evoke a sensorimotor response discernible from background noise. Previous publications have simply indicated threshold values of 20 μV to determine what was considered a supra-threshold EMG response to spinal stimulation [32, 33]. We describe a more robust methodology that takes into account any noise in the signal that may rise above the simple thresholds used in previous studies. To quantify the sub-threshold samples, we followed a similar bootstrap procedure as described above, computed the mean covariance between the split-half EMG means and , and scaled these values to the range [0, 1]. Trials with this covariance metric less than 0.1 were rejected as sub-threshold samples. The covariance threshold is a hyperparameter that was empirically determined and was motivated by our average-case reliability metric.
EMG summarization
Prior research, via a combination of computational modeling, patient studies and experimenter intuition, laid out guidelines for the effective summarization of raw temporal EMG waveforms into compact representations [5, 7]. We adhered to said guidelines for constructing lower-dimensional EMG representations as:
| (3) |
Here, denotes the raw EMG waveform obtained during trial r from EMG contact k. ηq(k) denotes the q-th percentile activity value of zr,k, over all trials r ∈ {1..R}. |.| is the absolute value function, and Clip[x, {a, b}] simply denotes the hard clip operation confining the range of x to [a, b]. Unless specified otherwise, we set q = 95 and T = 300ms for our analyses. The EMG summary for trial r is thus xr = [xr,1, xr,2, …, xr,K], where K is the total number of used EMG contacts.
EES parameterization
In our setup, we configured EES for each trial using three degrees of freedom. For the neural network analyses, we represented EES for trial r as the vector θr = [μr, ar, Er,e], where μr and ar denote the frequency and amplitude, respectively, of the pulse train used for trial r. Er,e is a binary vector with a value of 1 at index e (the stimulated electrode contact during trial r) and 0 elsewhere. Frequency and amplitude values were normalized to the range [0, 1), for neural network training purposes.
2.4. Forward model (fϕ) specification
In this study, we used a densely connected, feedforward deep neural network model, also known as a Multi-Layer Perceptron (MLP), as our forward model (Fig. 3a). We trained this model end-to-end using Stochastic Gradient Descent, implemented via the Adam algorithm [34], to learn a mapping between EES parameters and corresponding evoked EMG. Specifically, we factorized our forward model into embedding, core, and readout modules. The embedding module received as input the parameterized EES, and projected this into a feature space that is fed to the core module. The core module was responsible for transforming the embedded features such that the readout module is able to use these to predict the summarized EMG response. We adopted this factorization to explicitly provide a framework for fairly evaluating diverse model architectures, in place of the core module, in the future. In our experiments, each module consisted of a linear layer followed by a non-linear rectifying (ReLU) activation function. Our embedding and core feature spaces were 16 and 256-dimensional respectively. We trained the model by minimizing the L1 loss between the predicted and groundtruth EMG summaries:
| (4) |
Figure 3: Forward model fϕ accurately predicts EES-evoked motor outputs in silico.

(a) fϕ learns to transform parameterized EES into a summary EMG measure by backpropagating error gradients. (b) Numerical evaluation of the forward model predictions on data from four different sheep shows that it captures nearly all of the explained variance (L1 → 0) in the motor outputs. The red crosses denote a “random” baseline performance (c) Marginal parameter recovery of parameters μ (left) and a (right) for each of the four sheep using the correspondingly trained fϕ confirms successful amortization of spinal sensorimotor computations.
In Eq. 4, y denotes the predicted EMG summary while N, K refer to the total number of training samples and number of EMG contacts used respectively. Model parameters were updated using the Adam optimization algorithm [35] with an initial learning rate lr = 1e − 2 for 1000 epochs. Additionally, we used a L2 weight decay of 5e − 4 and 50% variational dropout before the readout module to regularize the network and prevent over-fitting. Additional details regarding the train vs. test data splits are specified in Appendix C.
2.5. Inference model specification
To tackle the inverse problem (Fig. 1c), we adopted and augmented the Sequential Neural Posterior Estimation algorithm for our use case of controlling sensorimotor activation via EES [24]. We outline our procedure in Algorithm 1. Our primary contribution was in the reformulation of the typical approximate Bayesian inference setting to instead use amortized neural networks as “simulators”, and estimate posterior densities over their input space. Additionally, to circumvent the problem of dealing with discrete vectors in the EES parameter space, we instead trained electrode-conditional models. For training an electrode-conditional inverse model, we treated EES parameters μ and a as random variables, and clamp E to reflect the binary vector Ei with a value of 1 at index i (the conditioned electrode contact) and 0 elsewhere. We trained all such electrode-conditioned inverse models in parallel, and thus at no additional time cost.
For each electrode-conditioned inverse model, we started by defining a Uniform prior over the range of frequencies and amplitudes, and sampled a number of parameter sets from this prior. We treated our amortized forward model fϕ as a “simulator”, and used it to construct a simulated dataset {(θj, xj)} from these sampled parameter sets. The benefits of using fϕ as a simulator, as opposed to mechanistic models in typical simulation-based inference settings, were two-fold. First, simulations using fϕ only involved forward passes through a neural network, which occurred in a massively parallel manner and was rapid. In contrast, simulations using mechanistic models are typically orders of magnitudes slower. Second, the “learnability” of fϕ imparted flexibility both in the fundamental nature of the mapping being approximated, as well as input/output parameterizations.
Algorithm 1.
Controlling EMG activity by identifying optimal EES protocols
| Require: π(θ) | ▷ prior over EES parameters |
| Require: fϕ : Concat([θ, E_]) → x | ▷ trained forward model mapping EES to EMG |
| Require: x* | ▷ target EMG |
| Require: Ne | ▷ number of EES electrode contacts |
| for i ϵ {0..Ne} in parallel do | |
| r ← 1 | |
| pi(θ) := π(θ) | ▷ initialize target density with prior |
| while r ≤ 2 do | |
| ▷ sample a batch of parameters | |
| ▷ simulate via an electrode-conditioned forward pass | |
| ▷ gradient descent | |
| ▷ update target density | |
| r ← r + 1 | |
| ▷ get the final posterior | |
| ▷ sample EES | |
| ▷ determine optimal EES |
We instantiated each inverse model as a Masked Autoregressive Flow (MAF) [36]. comprised multiple stacks of invertible transformations and could be interpreted as a deep normalizing flow. The overall objective of the inverse model was to learn to approximate the posterior density p(Concat[μ, a, Ei] | x). Training proceeded by using the simulated data (EMG) {xj} (as context) and parameters {θj} as inputs to , which transformed random values from a preset, standard distribution (such as a multivariate normal) to our target distribution. Network parameters ψ(i) were optimized by minimizing the negative log probability loss (Eq. 5).
| (5) |
where q(.) is an estimate of the posterior density, whose parameters are specified by the output of . To refine this posterior to a specific target EMG activity pattern x0, we repeated the aforementioned process albeit with minor modifications to initially sample parameters from the amortized posterior (instead of the prior) and modifying the loss function to reflect this change [30]. EES samples drawn from the refined posterior were then used in vivo to observe their effect on sensorimotor network activation. Further details regarding hyperparameter choices in this process are described in Appendix D.
3. Results
3.1. Neural networks precisely capture the function of spinal sensorimotor computations
Converging evidence for low-dimensional neural dynamics governing the non-linear transformation of sensory stimuli to motor outputs indicates that artificial neural networks might be well suited to approximate spinal sensorimotor computations. We adopt a class of densely connected feedforward DNNs to learn a mapping from EES inputs to motor outputs. Additionally, by efficiently parameterizing EES settings and summarizing EMG data, we further tailor the problem formulation to maximally benefit from DNNs’ function approximation capabilities.
To demonstrate the utility of our forward model fϕ (Section. 2.4), we train it on data collected from four different sheep. In each animal, we recorded EMG from four bilateral lower extremity muscles, and discard signal from noisy contacts. As per standard machine learning practice, we hold out 10% of each dataset as a dedicated test set. In particular, the test set exclusively consisted of trials with at least one of the EES parameters, frequency (μ) or amplitude (a), unseen during training. Setting up the test samples this way allowed us to evaluate the true degree to which fϕ learns non-linear sensorimotor computations, since this would involve both soft (interpolate along a single EES parameter) and hard (interpolate over multiple EES parameters) generalization (Appendix C).
We first evaluate the goodness of fit of fϕ in silico by computing the per-EMG contact L1 metric between the network predictions and the observed EMG activity for various EES inputs in our test data. Numerical results for the four animals are reported in Fig. 3b and Table. 1. An L1 value of 0 signifies “perfect” model performance, defined as capturing 100% of the explainable variance of evoked motor outputs for any given EES input. Additionally, to contextualize the performance of fϕ, we compute a “random” baseline prediction error (red crosses; Fig. 3b). The distribution of model prediction errors for each animal differed significantly from the baseline predictions with our model prediction errors being significantly lesser (Sheep A (Mann–Whitney U = 4.0, n1 = n2 = 52, p < .001); Sheep B (Mann–Whitney U = 0.0, n1 = n2 = 26, p < .001); Sheep C (Mann–Whitney U = 0.0, n1 = n2 = 136, p < .001); Sheep D (Mann–Whitney U = 1.0, n1 = n2 = 144, p < .001)). We report the average training time of fϕ to be 33.25 ± 16.9s on a standard 16-core Intel Xeon Gold 6242 CPU workstation.
Table 1: Numerical results accompanying Fig. 3c.
We report the L1 errors per-EMG contact, on a dedicated held-out test dataset, for models trained on each of the four sheep. Errors are reported as mean ± standard deviation (in arbitrary units as given by the normalized EMG scale).
| EMG Contact | Sheep A | Sheep B | Sheep C | Sheep D |
|---|---|---|---|---|
|
| ||||
| LPeroneus | 0.041 ± 0.047 | 0.007 ± 0.009 | 0.012 ± 0.024 | 0.029 ± 0.06 |
| LGastrocnemius | 0.046 ± 0.059 | 0.016 ± 0.02 | 0.01 ± 0.023 | 0.041 ± 0.04 |
| LBicepsFemoris | - | - | 0.011 ± 0.017 | - |
| LGracilis | 0.058 ± 0.071 | 0.027 ± 0.029 | 0.023 ± 0.043 | 0.04 ± 0.068 |
| RPeroneus | 0.04 ± 0.044 | 0.03 ± 0.033 | 0.019 ± 0.043 | 0.028 ± 0.046 |
| RGastrocnemius | 0.037 ± 0.035 | 0.032 ± 0.048 | 0.024 ± 0.047 | 0.045 ± 0.046 |
| RBicepsFemoris | - | - | 0.03 ± 0.052 | 0.013 ± 0.036 |
| RGracilis | 0.043 ± 0.046 | 0.019 ± 0.018 | 0.038 ± 0.054 | 0.029 ± 0.07 |
As a precursor to performing complete probabilistic inference in vivo, we test the ability of the correspondingly trained fϕ to “recover” EES parameters used in a trial of interest using Maximum Likelihood Estimation (MLE). We define “recovery” here as the ability to identify the value of a specific EES parameter θj, which when used along with other given EES parameters θ−j makes the observed EMG response x most probable. The results of our evaluation for θj ∈ {μ, a} are presented in Fig. 3c. We found that the MLE estimates of parameters μ and a were significantly correlated with the respective ground truth values on the held-out test trials. Specifically, we computed the Pearson correlation coefficient, r, between the MLE estimates and ground truth values and test for the slope of the regression line being significantly different from 0 using the Wald test with t-distribution of the test statistic (Sheep A (μ(r = .974, p < .001); a(r = 0.968, p < .001)), Sheep B (μ(r = .958, p < .001); a(r = 0.965, p < .001)), Sheep C (μ(r = .601, p < .001); a(r = 0.969, p < .001)), Sheep D (μ(r = .767, p < .001); a(r = 0.645, p < .001))). We thus verify that fϕ is indeed a good functional approximation of spinal sensorimotor computations.
3.2. Neural network guided EES optimally shapes muscle recruitment
Leveraging the successful amortization of spinal sensorimotor computations by our forward model, we trained and deployed our inverse models in vivo to drive motor outputs into targeted regimes. Figure 4 provides an overview of the process. Our electrode-conditioned inverse model uses the forward model fϕ, and a desired, novel target EMG pattern to estimate the posterior probability density over the full space of EES parameters (Algorithm 1). We sampled from this posterior distribution to identify candidate EES parameters, which are then tested in silico first then in vivo. The whole process was fully automated. To quantify the success of our approach we measured how well the evoked EMG in vivo aligned with the “target” EMG pattern, as well as how well it aligned with the forward model output.
Figure 4: Neural network-guided optimal recruitment of muscles.

(a) Electrode-conditioned inverse models use the trained forward model fϕ to estimate the posterior density over EES parameters given a target pattern of EMG activity. (b) Sampling from this posterior density yields optimal EES parameters which we test in silico and in vivo. We successfully demonstrate the ability to control sensorimotor network activation through our fully automated procedure.
We performed in vivo testing on Sheep C and D. Sheep A damaged their electrode midway into the study. Sheep B had to be removed from the study due to non-study-related health issues, which prevented awake behaving tests. In each sheep, we apply Algorithm 1 for NT novel EMG targets . By “novel”, we allude to the fact that neither our forward models nor inverse models have seen this pattern of EMG during their respective training phases. Our procedure returns NP distinct EES proposals for each EMG target, which are then applied for NR repeats. To obtain the EES proposals we first sample EES parameters from the respective electrode-conditioned posterior densities and then jointly maximize the likelihood and minimize the in silico loss . In this set of experiments we set NT = NP = 5 and NR = 10. The specificity of evoked EMG adjudicated the optimality of sampled EES in our context. To confirm that EMG responses are not invariant to EES parameters, we also tested “non-optimal” parameters in silico to verify that the resulting EMG patterns differ significantly from the target (Fig. 5d). Non-optimal EES were picked as having low posterior density. A complete numerical analysis of the neural network guided in vivo experiments is presented in Fig. 6. The efficacy of our model-guided EES trials parallels the achievable upper-bound as specified by the inter-trial reliability of EMG responses. A nonparameteric Mann-Whitney U test confirmed that the distribution underlying the ideal upper-bound correlations was statistically identical to the distribution underlying the correlations between targets and our model-guided EMG activities for both Sheep C (Mann–Whitney U = 635.0, n1 = n2 = 39, p = .105) and Sheep D (Mann–Whitney U = 1650.0, n1 = n2 = 60, p = .216). Over a randomly selected set of n = 50 EMG targets, we report the training time for our electrode-conditioned inverse models , with a median of 69.8s. On this same set, EES proposal sampling times with a median of 1.53s.
Figure 5: Discovering functionally equivalent EES protocols.

(a-c) Our automated search through the EES parameter space optimally identifies pulse train parameters for different spinal electrode contacts to evoke similarly correlated sensorimotor responses. (d) Our approach is also well-calibrated and correctly assigns uniformly low posterior probabilities to sites where no EES configuration can elicit desired EMG response.
Figure 6: Neural network guided EES evokes desired motor outputs in vivo.

We measure the efficacy of our model-guided EES trials by computing the correlation between the evoked EMG response and the target EMG response. We note that this correlation profile closely mimics the soft upper-bound given by the correlation between EMG signals evoked by the same EES parameters recorded at different times.
As we note earlier in the manuscript, the transformation of EES to EMG is a complex, non-linear process which moreover can be many-to-one (a single EMG pattern can result from many EES parameters). Lending credence to this argument, we are able to automatically identify a variety of EES that evoke similar sensorimotor responses in vivo (Fig. 5a–c). Data presented here reveal that stimulating different epidural electrode contacts with appropriately chosen pulse trains can be functionally equivalent, despite these EES configurations being spatially distinct. In this spatial EES search, we also demonstrate that our system is well calibrated and correctly assigns low posterior probabilities in cases where there exists no possible way to achieve the target EMG by stimulating a specific electrode contact (Fig. 5d).
The end-to-end time for executing the training of our inverse model, sampling EES parameters for given EMG targets, and testing these EES samples in vivo was ~ 20 min per animal. The target EMG patterns used were arbitary, and novel. Despite no explicit knowledge of either spinal physiology nor specifics of the electrode anatomy made available to the system, our algorithm was functionally well-calibrated and effectively controlled spinal sensorimotor network activation.
3.3. Non-identifiable EES protocols pave the way to study parameter trade-offs
Both the Maximum Likelihood Estimation analysis (Fig. 3c) and the spatial EES search (Fig. 5) indicate the non-identifiability of the mapping from EES parameters to EMG activation. By non-identifiability, we refer to the scenario of two or more unique EES parameter configurations producing observationally equivalent EMG outputs. The presence of complex posterior geometries (for example, Fig. 5b) suggest that spinal sensorimotor circuits may embody this inherent redundancy as well. Distinct sensorimotor pathways may potentially compensate (or trade-off) for the reduction or gain in individual EES parameter values while conserving the overall function of the system. A systematic way to understand these trade-offs would help in identifying their neural substrates. Though so far we have seen the non-identifiability of EES in a varying electrode-context, here we present evidence for parameter trade-offs within the same electrode (Fig. 7).
Figure 7: Parameter trade-offs in EES emerge naturally from our system.

Our forward model fϕ is able to identify discernably different EES parameters that evoke identical motor outcomes. This system as a whole allows for systematic investigation of compensatory spinal mechanisms involved in the sensorimotor pathways.
We compute level sets, in the posterior, defined as contours along which the posterior probabilities remain constant. We draw EES samples that lie along a contour and use the forward model fϕ to predict sensorimotor network activation in silico. EES samples on a level set in the posterior evoke near-identical sensorimotor responses thus confirming our parameter trade-off hypothesis. Fig. 7 presents a visual example wherein unique EES parameters are shown to elicit identical motor outputs. Prior work from other groups on computational models of spinal circuitry have helped delineate mechanisms of endogenous interactions between neurons from the effect of exogenous inputs such as EES [27, 37]. Such models also aid in identifying circuit modulations, either via altering spinal connections or EES parameters, that change motor outputs. However, these models were explicitly constructed to include these model features. For the first time, we show that facets of neural interactions emerge naturally from optimizing for functional outcomes. The present study lays the groundwork for a powerful framework that allows for unbiased and systematic theoretical investigation of spinal neuromodulation through in silico electrophysiology.
4. Discussion
In this study, we demonstrate the first fully-automated, data-driven, and subject-agnostic method to optimally control spinal sensorimotor network activity via EES. Herein, we present data collected from four sheep, each implanted with two 24-contact EES electrode arrays on the lumbosacral spinal cord. We first showcase the ability to functionally approximate spinal sensorimotor computations with a feedforward deep neural network. Our forward model approximation of spinal sensorimotor computations was precise, and was able to accurately predict EMG outputs based on EES parameters (Fig. 3). After this amortization step, we leveraged our inverse model family and learn to control motor outputs from the forward model by optimally manipulating EES parameters. Our method identified, within minutes of computational effort on typical hardware, novel EES parameters that produced desired target EMG recruitment in vivo (Figs. 4,5). We numerically verified the efficacy of these EES proposals by computing the correlation between the evoked and target EMG activity which approached the performance ceiling (Fig. 6). In addition to being fully automated, our approach is also orders of magnitude faster than manual optimization of EES protocols per-subject.
The ability to control neural population activity has been of long-standing interest to the broader neuroscience community [38–40]. Several model-based and model-free solutions to this problem have been proposed, each having their own merits and demerits. On the one hand, model-free approaches do not rely on explicit neural circuit-specific knowledge and are fast. However, they do not support drawing inferences across subjects. On the other hand, model-based approaches rely on domain knowledge and large amounts of training data but can generate testable hypotheses and be used for system identification. Specifically in the context of controlling motor neuron activity, multiple efforts have demonstrated that neuromodulation of the spinal cord with EES can restore voluntary motor function, including standing and stepping in individuals diagnosed with severe chronic incomplete SCI [4–12]. The most successful of approaches thus far have relied on engaging proprioceptive feedback circuits to activate central pattern-generating networks, which in-turn allowed proprioceptive signals to drive motor control [13, 27]. These feedback circuit models were also extended to methodologies for optimally selecting electrode locations for recruiting specific subsets of sensory nerve fibers to restore locomotion in rodents [41], non-human primates [21], and human patients [7] with SCI.
These systems, however, suffer from three primary drawbacks: (1) The EES stimulation protocols themselves were empirically determined via systematic search; (2) Only highly prototypical movement patterns were targeted; and (3) They relied on complex peri-surgical imaging, testing, and device personalization. Overall, this process was laborious and time-consuming with widely varying configurations between subjects due to differences in the pathophysiology of their SCI and differences in spinal cord anatomy and electrode placement. The detailed biophysical models of the proprioceptive feedback circuits, accompanying these systems, formalized the modulatory effect of exogenous EES. Model parameters were either tuned manually or selected by performing a brute-force grid search, a process both computationally expensive and limiting the capacity for generalization.
Our system can be viewed as a hybrid between model-based and model-free approaches. By defining our forward model as a universal function approximator and reformulating the problem to utilize low-dimensional output summary statistics and parameter representations, we can “learn” directly from relatively few samples without specific knowledge about the underlying neural circuitry. We also retain the ability to amortize information across subjects, which, given recent developments in the transfer learning literature can potentially help in the reduction of data budgets and thereby experimental time. Moreover, our models are parameter-efficient and the end-to-end run time of the system makes it practically feasible and convenient. The notion of using deep neural networks to amortize data generation processes has been explored in the past [25]. However, this was only in the context of synthetic data generated from simple stochastic models. In fact, machine learning approaches for surrogate modeling is now emerging as a research frontier in and of itself [42, 43]. We present the first evidence that this framework can be adopted for sophisticated experimental data for which mechanistic explanations are lacking or infeasible to generate.
In a broader context, the development of deep neural network solutions within the space of neuromodulation holds great promise for the future. Intelligent control of neuroprostheses could enable more seamless interaction between the user and the neural interface, and lead to more efficient movement after neural injury [44, 45]. Prior work has utilized Bayesian optimization of peripheral stimulation to evoke lower extremity movements [46], and machine learning has been used to predict EES outcomes [47, 48]. However, our system presents the first demonstration of the applicability of deep learning systems for spinal neuromodulation in vivo. From a practical perspective, the data-driven approach employed here only cost minimal experimental time for obtaining EES trials used for training the neural networks. Post-amortization of the mapping between EES and EMG outputs, we were able to successfully reuse these networks to derive stimulation proposals for any number of EMG targets at no additional cost. Our modeling approach did not require any specific knowledge about the anatomy of the spinal tracts and hence did not necessitate any intra-operative imaging. From a theoretical perspective, the degeneracy of the mapping between EMG outputs and EES highlighted by our system opens up the space for addressing several questions in the future. Biological principles dictate that, for effective activation of motor neurons, EES targets large-diameter afferent fibres through the dorsal roots at motor threshold [18]. Without any explicit knowledge about the location of such dorsal roots, we were able to identify multiple EES configurations that produced desired outputs. These findings suggest the existence of redundant mechanisms of complex motor output production implemented by spinal circuitry that can be probed systematically with our system in-the-loop.
From an end user’s perspective, our framework takes as input any arbitrary pattern of muscle activations and outputs relevant EES parameter choices. Since our models were trained with EMG responses that effectively captured both motor activation via transynaptic activation of sensory neurons as well as direct activation of motor neurons at high stimulation amplitudes [13, 49], target EMG patterns can be chosen to reflect sensorimotor computations of neuromuscular excitation and inhibition that may be necessary for functional behavior. Additionally, previous clinical EES studies directly translated EMG data recorded at rest without ascending or descending input to use during spatiotemporal EES where stimulation is applied at specific time-locked portions of complex tasks such as locomotion [7, 18]. Therefore, the models described here could potentially be applicable to re-enabling complex motor function in individuals with spinal cord injury.
Although the work described here provides an algorithmic framework for quickly determining effective stimulation parameters, there are limitations in this study that should be noted. Long-term use of EES in clinical populations has resulted in improved motor performance [5–7], and in select cases has led to study participants regaining movement without stimulation [50, 51]. Currently our algorithm uses static models trained once and does not account for changes with long-term use of EES in a clinical population. Development of continual learning algorithms that are capable of adapting their behavior over time are currently of great interest to the machine learning community [52]. Therefore, future work in this field should focus on the continued development of these algorithms to non-stationary conditions and task improvements over time. Additionally, our stimulation was applied while the animal was in an unloaded state. Previous literature has indicated the importance of somatosensory input from the periphery during gait and standing activities that increases biological stochasticity and is necessary to provide proprioceptive information regarding limb position during active tasks [49, 53]. Future experimentation using this model should account for changes due to increased somatosensory input, and incorporate machine learning algorithms to precisely control stimulation timing in complex tasks such as locomotion as has been performed previously using intraspinal microstimulation (ISMS) experiments in cats [54, 55]. Furthermore, although our algorithm produced comparable results across all animals included within this study, the methodology requires retraining to produce similar results across a wide range of subjects. Differences in spinal anatomy, electrode design, electrode positioning, and the presence of an SCI may alter the EES to EMG mappings in new subjects or implantations, and further work in a larger population is necessary to account for these differences. Finally, we restricted our inferred parameters to electrode location, stimulation amplitude, and stimulation frequency, while leaving pulse width constant. Computational studies have shown that pulse width can change the recruitment of neural structures during SCS [56]. Therefore, future work should include this as another variable that can be inferred using machine learning approaches to the neuromodulation field.
Spinal neuromodulation is an emerging field, and the work described here is a necessary addition to aid in the development and discovery of EES protocols in a fast, data-efficient, and subject-agnostic manner. Rapid discovery of these protocols for neuromodulation devices currently represents one of the largest barriers to the clinical translation of EES. The development of artificially intelligent tools, such as the one presented in this manuscript, will aid in scaling up EES to the clinical space and realize meaningful benefits for spinal rehabilitation in the future.
5. Acknowledgments
We would like to thank Aaron Gregoire and the Center for Animal Resources and Education (CARE) staff for their assistance with animal care. We would like to thank John Murphy for his engineering expertise in designing modifications to the sling apparatus. We would also like to thank Kendall Lane for illustrations used in Figures 1 and 2. We thank Alexander Fengler and Jaeson Jang for their detailed feedback on the manuscript. We would like to thank Sean McPherson and Wenzhe Xue for providing programming support and technical guidance. This project was additionally supported by the Brainstorm program within the Carney Institute for Brain Science.
Financial Support:
This work was sponsored in part by the Defense Advanced Research Projects Agency (DARPA) BTO under the auspices of Dr. Alfred Emondi through the (Space and Naval Warfare Systems Center, Pacific OR DARPA Contracts Management Office) grant/contract no. D15AP00112 to DAB. JSC was supported by the NINDS T32 Postdoctoral Training Program in Recovery and Restoration of CNS Health and Function (5T32NS100663-04) under guidance of DAB. SRP was supported by the 2020 Susan and Isaac Wakil Foundation John Monash Scholarship. Additional support provided by the Center for Computation and Visualization (CCV) and computing hardware supported by NIH Office of the Director grant S10OD025181.
A. Representative bilateral EMG activity upon EES
Figure 8: Representative data samples.

We randomly selected EES trials from a single animal to visualize bilateral rectified EMG responses to a single EES pulse train. Data shown here includes a 100ms pre-stim and a 400ms post-stim period. The onset of EES response is marked by the vertical gray dotted line at 0ms.
B. Kinematics acquisition and analysis
Figure 9: Video acquisition setup.

We recorded sRGB videos from three cameras simultaneously. The cameras were positioned to maximally cover the range of our subject’s hind limb motion.
Figure 10: EMG serves as a proxy for physical limb motion.

The summarized EMG activity recorded at each muscle contact highly correlated with the EES-evoked angular displacement of the ipsilateral hind limb. Each point in these plots refer to a unique trial. Data presented here only includes trials where EES was applied on a midline electrode contact.
We performed simultaneous sRGB video recording from three cameras placed at a distance of 150cm from the subject as shown in Fig. 9. The left and right cameras were placed orthogonal to each other, with the rear camera placed directly behind the subject. Camera placement was dictated by three factors: (1) The coverage of the full range of the subject’s hind limb motion; (2) The ability to disambiguate joint locations during self-occlusions; and (3) The overlap in the field of views of the three cameras. We used DeepLabcut, a markerless pose estimation toolkit, to extract hind limb kinematics [57]. Specifically, we used a standard 50 layer Residual Network (ResNet-50) as the convolutional backbone for DeepLabCut [58]. The ResNet-50 layers were initialized with ImageNet pre-trained weights, and fine-tuned for our purposes. To opportunistically maximize the precision of joint detection, we trained a separate model for each viewpoint. We randomly selected 50 ideal frames per-view, and manually annotate three key points (Hip, Hock, and Hoof) per limb. Ideal frames are defined as those with no self-occlusions.
B.1. Functionally correlating EMG and Kinematics
All the analysis presented in the manuscript relied on motor output as measured by Electromyography (EMG). Here, we show that summarized EMG activity is also highly correlated with the physical motion of the ipsilateral limb as measured by kinematics. The intent of this analysis was to validate that the EMG responses we obtained during testing also resulted in kinematic outcomes that would be useful in locomotion. To so do, we perform midline EES (3 electrode contacts, 588 trials) with frequencies μ ∈ {10, 25, 50, 100}Hz and amplitudes a ∈ [60, 1500]μA. Kinematics during these trials, computed using the computer vision system described in B, was used to compute the EES-evoked angular displacement of the hind limbs. Limb displacement was calculated as the change in hip angle in the sagittal plane from baseline as a result of stimulation. Movements caused by stimulation were primarily hip flexion/knee extension. Figure 10 presents the correlation analysis between each summarized EMG channel activation and the angular displacement of the corresponding hind limb. Angular displacement of the hip was chosen to represent the gross overall movement of the hindlimb during application of EES. As shown in Figure 10, all muscles demonstrate relatively high levels of correlation between EMG activity and kinematic movement. Although activation of each muscle has different biomechanical effects, the correlations between angular displacement of the hip and each recorded EMG were simply used to demonstrate that the mappings between EES and EMG could be useful in predicting kinematic outputs in addition to EMG.
C. Forward model specifics
As per standard machine learning practice, we partitioned EES trials from each dataset into dedicated train and test splits. To do so, we followed a scheme as presented in Fig. 11. We observed that the EMG responses to systematically varying EES are highly non-linear (Fig. 2c–d), and thus wanted to test the generalization ability of our forward model fϕ. Specifically, we wanted to test two types of generalization: (1) Soft generalization: the model’s ability to interpolate along a single unseen parameter dimension, and (2) Hard generalization: the model’s ability to interpolate within a completely novel parameter regime. fϕ is trained on trials that used EES parameters from the unshaded regions (Fig. 11). The goodness of fit of fϕ is computed by evaluating the network on trials with EES parameters from the shaded regions. Note that these are completely non-overlapping. The region enclosed by the blue boundary tests the “soft” generalization capacity of fϕ, while the region enclosed by the red boundary tests “hard” generalization.
Figure 11: Partitioning the EES parameter space.

We “hold out” trials that used EES parameters in the marked regions from the forward neural network model training. These trials are exclusively used to evaluate the goodness of fit of the forward model and test its generalization capabilities.
Figure 12: Training and validation curves.

We demonstrate the ability of fϕ (trained on each animal individually) to effectively learn the forward mapping from EES to EMG. Here we show loss curves over the course of training as given by L1 errors, as well as correlations between the predicted and ground truth validation EMG.
D. Inverse model hyperparameter specifications
| Hyperparameter | Description | Value |
|---|---|---|
|
| ||
| num_rounds | The total number of rounds of refinement from a globally amortized posterior to a datapoint-specific posterior | 2 |
| num_simulations | The total number of EES trials to be “simulated” (and used) per round of inverse neural network model training | 1024 |
| simulation_batch_size | Batch size for simulating data from the amortized forward neural network model | 1000 |
| training_batch_size | The training batch size of the inverse neural network models | 50 |
| num_samples | The number of EES parameter sets to be drawn from the approximated posterior density to construct the pairwise density plots | 10000 |
| filteringx_ratio | The fraction of EES proposals (sampled from the posterior distribution) selected for filtering based on target correlation after sorting all EES proposals based on their log probability | 0.1 |
| num_proposals | The number of unique EES parameters (per EMG target) to be selected from the posterior samples for in vivo testing | 5 |
| timeout | Upper bound on the time to convergence (in seconds) to wait for the training of the inverse models | 600 |
Footnotes
Conflict of Interest Statement: JSC, RD, SRP, and DAB have patents pending regarding the recording of spinal electrophysiological signals during spinal cord stimulation.
References
- [1].Chauhan Neelima B. Chronic neurodegenerative consequences of traumatic brain injury. Restorative neurology and neuroscience, 32(2):337–365, 2014. [DOI] [PubMed] [Google Scholar]
- [2].Courtine Grégoire and Sofroniew Michael V. Spinal cord repair: advances in biology and technology. Nature medicine, 25(6):898–908, 2019. [DOI] [PubMed] [Google Scholar]
- [3].James Nicholas D, McMahon Stephen B, Field-Fote Edelle C, and Bradbury Elizabeth J. Neuromodulation in the restoration of function after spinal cord injury. The Lancet Neurology, 17(10):905–917, 2018. ISSN 14744422. doi: 10.1016/S1474-4422(18)30287-4. URL https://linkinghub.elsevier.com/retrieve/pii/S1474442218302874. [DOI] [PubMed] [Google Scholar]
- [4].Calvert Jonathan S, Grahn Peter J, Strommen Jeffrey A, Lavrov Igor A, Beck Lisa A, Gill Megan L, Linde Margaux B, Brown Desmond A, Van Straaten Meegan G, Veith Daniel D, et al. Electrophysiological guidance of epidural electrode array implantation over the human lumbosacral spinal cord to enable motor function after chronic paralysis. Journal of neurotrauma, 36(9):1451–1460, 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [5].Gill Megan L, Grahn Peter J, Calvert Jonathan S, Linde Margaux B, Lavrov Igor A, Strommen Jeffrey A, Beck Lisa A, Sayenko Dimitry G, Van Straaten Meegan G, Drubach Dina I, et al. Neuromodulation of lumbosacral spinal networks enables independent stepping after complete paraplegia. Nature medicine, 24(11):1677–1682, 2018. [DOI] [PubMed] [Google Scholar]
- [6].Angeli Claudia A., Boakye Maxwell, Morton Rebekah A., Vogt Justin, Benton Kristin, Chen Yangshen, Ferreira Christie K., and Harkema Susan J. Recovery of Over-Ground Walking after Chronic Motor Complete Spinal Cord Injury. The New England journal of medicine, 379(13):1244–1250, 2018. ISSN 1533-4406. doi: 10.1056/NEJMoa1803588. URL http://www.nejm.org/doi/10.1056/NEJMoa1803588 http://www.ncbi.nlm.nih.gov/pubmed/30247091. [DOI] [PubMed] [Google Scholar]
- [7].Wagner Fabien B, Mignardot Jean-Baptiste, Goff-Mignardot Camille G Le, Demesmaeker Robin, Komi Salif, Capogrosso Marco, Rowald Andreas, Seáñez Ismael, Caban Miroslav, Pirondini Elvira, et al. Targeted neurotechnology restores walking in humans with spinal cord injury. Nature, 563(7729):65–71, 2018. [DOI] [PubMed] [Google Scholar]
- [8].Grahn Peter J., Lavrov Igor A., Sayenko Dimitry G., Van Straaten Meegan G., Gill Megan L., Strommen Jeffrey A., Calvert Jonathan S., Drubach Dina I., Beck Lisa A., Linde Margaux B., Thoreson Andrew R., Lopez Cesar, Mendez Aldo A., Gad Parag N., Gerasimenko Yury P., Edgerton V. Reggie, Zhao Kristin D., and Lee Kendall H. Enabling Task-Specific Volitional Motor Functions via Spinal Cord Neuromodulation in a Human With Paraplegia. Mayo Clinic Proceedings, 92(4):544–554, 2017. ISSN 19425546. doi: 10.1016/j.mayocp.2017.02.014. [DOI] [PubMed] [Google Scholar]
- [9].Darrow David, Balser David, Theoden I Netoff Andrei Krassioukov, Phillips Aaron, Parr Ann, and Samadani Uzma. Epidural Spinal Cord Stimulation Facilitates Immediate Restoration of Dormant Motor and Autonomic Supraspinal Pathways after Chronic Neurologically Complete Spinal Cord Injury. Journal of neurotrauma, 36(15):2325–2336, August 2019. ISSN 1557-9042. doi: 10.1089/neu.2018.6006. URL [DOI] [PMC free article] [PubMed] [Google Scholar]
- [10].Harkema Susan, Gerasimenko Yury, Hodes Jonathan, Burdick Joel, Angeli Claudia, Chen Yang-sheng, Ferreira Christie, Willhite Andrea, Rejc Enrico, Grossman Robert G., and Edgerton V. Reggie. Effect of epidural stimulation of the lumbosacral spinal cord on voluntary movement, standing, and assisted stepping after motor complete paraplegia: A case study. The Lancet, 377(9781):1938–1947, 2011. ISSN 01406736. doi: 10.1016/S0140-6736(11)60547-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [11].Angeli Claudia A, Edgerton V Reggie, Gerasimenko Yury P, and Harkema Susan J. Altering spinal cord excitability enables voluntary movements after chronic complete paralysis in humans. Brain, 137(5):1394–1409, 2014. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [12].Lu Daniel C, Edgerton V Reggie, Modaber Morteza, AuYong Nicholas, Morikawa Erika, Zdunowski Sharon, Sarino Melanie E, Sarrafzadeh Majid, Nuwer Marc R, Roy Roland R, et al. Engaging cervical spinal cord networks to reenable volitional control of hand function in tetraplegic patients. Neurorehabilitation and neural repair, 30(10):951–962, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [13].Capogrosso Marco, Wenger Nikolaus, Raspopovic Stanisa, Musienko Pavel, Beauparlant Janine, Lorenzo Bassi Luciani Grégoire Courtine, and Micera Silvestro. A computational model for epidural electrical stimulation of spinal sensorimotor circuits. Journal of Neuroscience, 33 (49):19326–19340, 2013. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [14].Ladenbauer Josef, Minassian Karen, Hofstoetter Ursula S, Dimitrijevic Milan R, and Rattay Frank. Stimulation of the human lumbar spinal cord with implanted and surface electrodes: a computer simulation study. IEEE Trans. Neural Syst. Rehabil. Eng, 18(6):637–645, December 2010. [DOI] [PubMed] [Google Scholar]
- [15].Rattay F, Minassian K, and Dimitrijevic MR. Epidural electrical stimulation of posterior structures of the human lumbosacral cord: 2. quantitative analysis by computer modeling. Spinal Cord, 38(8):473–489, August 2000. [DOI] [PubMed] [Google Scholar]
- [16].Gerasimenko Yury P, Lavrov Igor A, Courtine Gregoire, Ichiyama Ronaldo M, Dy Christine J, Zhong Hui, Roy Roland R, and Edgerton V Reggie. Spinal cord reflexes induced by epidural spinal cord stimulation in normal awake rats. J. Neurosci. Methods, 157(2):253–263, October 2006. [DOI] [PubMed] [Google Scholar]
- [17].Minassian K, Persy I, Rattay F, Pinter MM, Kern H, and Dimitrijevic MR. Human lumbar cord circuitries can be activated by extrinsic tonic input to generate locomotor-like activity. Hum. Mov. Sci., 26(2):275–295, April 2007. [DOI] [PubMed] [Google Scholar]
- [18].Rowald Andreas, Komi Salif, Demesmaeker Robin, Baaklini Edeny, Sergio Daniel Hernandez-Charpak Edoardo Paoles, Montanaro Hazael, Cassara Antonino, Becce Fabio, Lloyd Bryn, Newton Taylor, Ravier Jimmy, Kinany Nawal, Marina D’Ercole Aurélie Paley, Hankov Nicolas, Varescon Camille, Laura McCracken Molywan Vat, Caban Miroslav, Watrin Anne, Jacquet Charlotte, Léa Bole-Feysot Cathal Harte, Lorach Henri, Galvez Andrea, Tschopp Manon, Herrmann Natacha, Wacker Moïra, Geernaert Lionel, Fodor Isabelle, Radevich Valentin, Van Den Keybus Katrien, Eberle Grégoire, Pralong Etienne, Roulet Maxime, Ledoux Jean-Baptiste, Fornari Eleonora, Mandija Stefano, Mattera Loan, Martuzzi Roberto, Nazarian Bruno, Benkler Stefan, Callegari Simone, Greiner Nathan, Fuhrer Benjamin, Froeling Martijn, Buse Nik, Denison Tim, Buschman Rik, Wende Christian, Ganty Damien, Bakker Jurriaan, Delattre Vincent, Lambert Hendrik, Minassian Karen, van den Berg Cornelis A. T., Kavounoudias Anne, Micera Silvestro, Van De Ville Dimitri, Barraud Quentin, Kurt Erkan, Kuster Niels, Neufeld Esra, Capogrosso Marco, Asboth Leonie, Wagner Fabien B., Bloch Jocelyne, and Courtine Grégoire. Activity-dependent spinal cord neuromodulation rapidly restores trunk and leg motor functions after complete paralysis. Nature Medicine, 2 2022. ISSN 1078-8956. doi: 10.1038/s41591-021-01663-5. [DOI] [PubMed] [Google Scholar]
- [19].Urbin MA, Liu Monica, Bottorff Elizabeth C, Gaunt Robert A, Fisher Lee E, and Weber Douglas J. Hindlimb motor responses evoked by microstimulation of the lumbar dorsal root ganglia during quiet standing. Journal of Neural Engineering, 17(1):016019, 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [20].Solinsky Ryan, Specker-Sullivan Laura, and Wexler Anna. Current barriers and ethical considerations for clinical implementation of epidural stimulation for functional improvement after spinal cord injury. Journal of Spinal Cord Medicine, 43(5):653–656, 2020. ISSN 20457723. doi: 10.1080/10790268.2019.1666240. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [21].Capogrosso Marco, Milekovic Tomislav, Borton David, Wagner Fabien, Moraud Eduardo Martin, Mignardot Jean-Baptiste, Buse Nicolas, Gandar Jerome, Barraud Quentin, Xing David, et al. A brain–spine interface alleviating gait deficits after spinal cord injury in primates. Nature, 539(7628):284–288, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [22].Ljung Lennart. System identification. In Signal analysis and prediction, pages 163–173. Springer, 1998. [Google Scholar]
- [23].Hastings W Keith. Monte carlo sampling methods using markov chains and their applications. Biometrika, 57, 1970. [Google Scholar]
- [24].Gonçalves Pedro J, Lueckmann Jan-Matthis, Deistler Michael, Nonnenmacher Marcel, Öcal Kaan, Bassetto Giacomo, Chintaluri Chaitanya, Podlaski William F, Haddad Sara A, Vogels Tim P, et al. Training deep neural density estimators to identify mechanistic models of neural dynamics. Elife, 9:e56261, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [25].Fengler Alexander, Lakshmi N Govindarajan Tony Chen, and Frank Michael J. Likelihood approximation networks (lans) for fast inference of simulation models in cognitive neuroscience. Elife, 10:e65074, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [26].Cranmer Kyle, Brehmer Johann, and Louppe Gilles. The frontier of simulation-based inference. Proceedings of the National Academy of Sciences, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [27].Formento Emanuele, Minassian Karen, Wagner Fabien, Jean Baptiste Mignardot Camille G. Le Goff-Mignardot, Rowald Andreas, Bloch Jocelyne, Micera Silvestro, Capogrosso Marco, and Courtine Gregoire. Electrical spinal cord stimulation must preserve proprioception to enable locomotion in humans with spinal cord injury. Nature Neuroscience, 21(12):1728–1741, December 2018. ISSN 15461726. doi: 10.1038/s41593-018-0262-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [28].Brehmer Johann, Louppe Gilles, Pavez Juan, and Cranmer Kyle. Mining gold from implicit models to improve likelihood-free inference. Proceedings of the National Academy of Sciences, 117(10):5242–5249, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [29].Tejero-Cantero Alvaro, Boelts Jan, Deistler Michael, Lueckmann Jan-Matthis, Durkan Conor, Gonçalves Pedro J, Greenberg David S, and Macke Jakob H. Sbi–a toolkit for simulation-based inference. arXiv preprint arXiv:2007.09114, 2020. [Google Scholar]
- [30].Greenberg David, Nonnenmacher Marcel, and Macke Jakob. Automatic posterior transformation for likelihood-free inference. In International Conference on Machine Learning, pages 2404–2414. PMLR, 2019. [Google Scholar]
- [31].Calvert Jonathan S, Darie Radu, Parker Samuel R, Shaaya Elias, Syed Sohail, McLaughlin Bryan L, Fridley Jared S, and Borton David A. Spatiotemporal distribution of electrically evoked spinal compound action potentials during spinal cord stimulation. Neuromodulation: Technology at the Neural Interface, 2022. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [32].Calvert Jonathan S, Manson Gerome A, Grahn Peter J, and Sayenko Dimitry G. Preferential activation of spinal sensorimotor networks via lateralized transcutaneous spinal stimulation in neurologically intact humans. Journal of Neurophysiology, 122(5):2111–2118, 2019. [DOI] [PubMed] [Google Scholar]
- [33].Calvert Jonathan S, Gill Megan L, Linde Margaux B, Veith Daniel D, Thoreson Andrew R, Lopez Cesar, Lee Kendall H, Gerasimenko Yury P, Edgerton Victor R, Lavrov Igor A, et al. Voluntary modulation of evoked responses generated by epidural and transcutaneous spinal stimulation in humans with spinal cord injury. Journal of Clinical Medicine, 10(21):4898, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [34].Kingma Diederik Pand Ba Jimmy. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. [Google Scholar]
- [35].Kingma Diederik P and Ba Jimmy. Adam: A method for stochastic optimization. arXiv preprint, arXiv:1412.6980, 2014. [Google Scholar]
- [36].Papamakarios George, Pavlakou Theo, and Murray Iain. Masked autoregressive flow for density estimation. In Advances in Neural Information Processing Systems, volume 30, 2017. [Google Scholar]
- [37].Kiehn Ole. Decoding the organization of spinal circuits that control locomotion. Nature Reviews Neuroscience, 17(4):224–238, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [38].Tafazoli Sina, MacDowell Camden J, Che Zongda, Letai Katherine C, Steinhardt Cynthia R, and Buschman Timothy J. Learning to control the brain through adaptive closed-loop patterned stimulation. Journal of Neural Engineering, 17(5):056007, 2020. [DOI] [PubMed] [Google Scholar]
- [39].Shenoy Krishna V and Kao Jonathan C. Measurement, manipulation and modeling of brain-wide neural population dynamics. Nature Communications, 12(1):1–5, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [40].Golub Matthew D, Byron M Yu, and Chase Steven M. Internal models for interpreting neural population activity during sensorimotor control. Elife, 4:e10015, 2015. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [41].Wenger Nikolaus, Eduardo Martin Moraud Jerome Gandar, Musienko Pavel, Capogrosso Marco, Baud Laetitia, Goff Camille G Le, Barraud Quentin, Pavlova Natalia, Dominici Nadia, et al. Spatiotemporal neuromodulation therapies engaging muscle synergies improve motor control after spinal cord injury. Nature medicine, 22(2):138–145, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [42].Zhu Yinhao, Zabaras Nicholas, Koutsourelakis Phaedon-Stelios, and Perdikaris Paris. Physics-constrained deep learning for high-dimensional surrogate modeling and uncertainty quantification without labeled data. Journal of Computational Physics, 394:56–81, 2019. [Google Scholar]
- [43].Zhu Yinhao and Zabaras Nicholas. Bayesian deep convolutional encoder–decoder networks for surrogate modeling and uncertainty quantification. Journal of Computational Physics, 366:415–447, 2018. [Google Scholar]
- [44].Tai Changfeng, Wang Jicheng, Shen Bing, Wang Xianchun, Roppolo James R, and de Groat William C. Hindlimb movement in the cat induced by amplitude-modulated stimulation using extra-spinal electrodes. J. Neural Eng, 5(2):111–124, June 2008. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [45].Dalrymple Ashley N and Mushahwar Vivian K. Intelligent control of a spinal prosthesis to restore walking after neural injury: Recent work and future possibilities. J. Med. Robot. Res., 05(01n02):2041003, March 2020. [Google Scholar]
- [46].Losanno E, Badi M, Wurth S, Borgognon S, Courtine G, Capogrosso M, Rouiller EM, and Micera S. Bayesian optimization of peripheral intraneural stimulation protocols to evoke distal limb movements. J. Neural Eng, 18(6):066046, December 2021. [DOI] [PubMed] [Google Scholar]
- [47].Desautels Thomas A, Choe Jaehoon, Gad Parag, Nandra Mandheerej S, Roy Roland R, Zhong Hui, Tai Yu-Chong, Edgerton V Reggie, and Burdick Joel W. An active learning algorithm for control of epidural electrostimulation. IEEE Trans. Biomed. Eng, 62(10):2443–2455, October 2015. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [48].Kachuee Mohammad, Moore Lisa D, Homsey Tali, Damavandi Hamidreza Ghasemi, Moatamed Babak, Hosseini Anahita, Huang Ruyi, Leiter James, Lu Daniel, and Sarrafzadeh Majid. An active learning based prediction of epidural stimulation outcome in spinal cord injury patients using dynamic sample weighting. August 2017.
- [49].Lavrov Igor, Courtine Grégoire, Dy Christine J, van den Brand Rubia, Fong Andy J, Gerasimenko Yuri, Zhong Hui, Roy Roland R, and Edgerton V Reggie. Facilitation of stepping with epidural stimulation in spinal rats: role of sensory input. J. Neurosci, 28(31):7774–7780, July 2008. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [50].Pino Isabela Peña, Hoover Caleb, Venkatesh Shivani, Ahmadi Aliya, Sturtevant Dylan, Patrick Nick, Freeman David, Parr Ann, Samadani Uzma, Balser David, Krassioukov Andrei, Phillips Aaron, Netoff Theoden I, and Darrow David. Long-term spinal cord stimulation after chronic complete spinal cord injury enables volitional movement in the absence of stimulation. Front. Syst. Neurosci., 14:35, June 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [51].Rejc Enrico, Angeli Claudia A, Atkinson Darryn, and Harkema Susan J. Motor recovery after activity-based training with spinal cord epidural stimulation in a chronic motor complete paraplegic. Sci. Rep, 7(1), December 2017. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [52].Delange Matthias, Aljundi Rahaf, Masana Marc, Parisot Sarah, Jia Xu, Leonardis Ales, Slabaugh Greg, and Tuytelaars Tinne. A continual learning survey: Defying forgetting in classification tasks. IEEE Trans. Pattern Anal. Mach. Intell, pages 1–1, 2021. [DOI] [PubMed] [Google Scholar]
- [53].Gill Megan L, Linde Margaux B, Hale Rena F, Lopez Cesar, Fautsch Kalli J, Calvert Jonathan S, Veith Daniel D, Beck Lisa A, Garlanger Kristin L, Sayenko Dimitry G, Lavrov Igor A, Thoreson Andrew R, Grahn Peter J, and Zhao Kristin D. Alterations of spinal epidural stimulation-enabled stepping by descending intentional motor commands and proprioceptive inputs in humans with spinal cord injury. Front. Syst. Neurosci., 14:590231, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [54].Dalrymple Ashley N, Everaert Dirk G, Hu David S, and Mushahwar Vivian K. A speed-adaptive intraspinal microstimulation controller to restore weight-bearing stepping in a spinal cord hemisection model. J. Neural Eng, 15(5):056023, October 2018. [DOI] [PubMed] [Google Scholar]
- [55].Dalrymple Ashley N, Roszko David A, Sutton Richard S, and Mushahwar Vivian K. Pavlovian control of intraspinal microstimulation to produce over-ground walking. J. Neural Eng, 17 (3):036002, June 2020. [DOI] [PubMed] [Google Scholar]
- [56].Lee Dongchul, Hershey Brad, Bradley Kerry, and Yearwood Thomas. Predicted effects of pulse width programming in spinal cord stimulation: a mathematical modeling study. Med. Biol. Eng. Comput, 49(7):765–774, July 2011. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [57].Mathis Alexander, Mamidanna Pranav, Cury Kevin M, Abe Taiga, Murthy Venkatesh N, Mathis Mackenzie Weygandt, and Bethge Matthias. Deeplabcut: markerless pose estimation of user-defined body parts with deep learning. Nature neuroscience, 21(9):1281–1289, 2018. [DOI] [PubMed] [Google Scholar]
- [58].He Kaiming, Zhang Xiangyu, Ren Shaoqing, and Sun Jian. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016. [Google Scholar]
