Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2020 Apr 1;123(4):1472-1485.
doi: 10.1152/jn.00641.2019. Epub 2020 Feb 26.

A neural network for online spike classification that improves decoding accuracy

Affiliations

A neural network for online spike classification that improves decoding accuracy

Deepa Issar et al. J Neurophysiol. .

Abstract

Separating neural signals from noise can improve brain-computer interface performance and stability. However, most algorithms for separating neural action potentials from noise are not suitable for use in real time and have shown mixed effects on decoding performance. With the goal of removing noise that impedes online decoding, we sought to automate the intuition of human spike-sorters to operate in real time with an easily tunable parameter governing the stringency with which spike waveforms are classified. We trained an artificial neural network with one hidden layer on neural waveforms that were hand-labeled as either spikes or noise. The network output was a likelihood metric for each waveform it classified, and we tuned the network's stringency by varying the minimum likelihood value for a waveform to be considered a spike. Using the network's labels to exclude noise waveforms, we decoded remembered target location during a memory-guided saccade task from electrode arrays implanted in prefrontal cortex of rhesus macaque monkeys. The network classified waveforms in real time, and its classifications were qualitatively similar to those of a human spike-sorter. Compared with decoding with threshold crossings, in most sessions we improved decoding performance by removing waveforms with low spike likelihood values. Furthermore, decoding with our network's classifications became more beneficial as time since array implantation increased. Our classifier serves as a feasible preprocessing step, with little risk of harm, that could be applied to both off-line neural data analyses and online decoding.NEW & NOTEWORTHY Although there are many spike-sorting methods that isolate well-defined single units, these methods typically involve human intervention and have inconsistent effects on decoding. We used human classified neural waveforms as training data to create an artificial neural network that could be tuned to separate spikes from noise that impaired decoding. We found that this network operated in real time and was suitable for both off-line data processing and online decoding.

Keywords: BCI; decoding; neural network; prefrontal cortex; spike-sorting.

PubMed Disclaimer

Conflict of interest statement

No conflicts of interest, financial or otherwise, are declared by the authors.

Figures

Fig. 1.
Fig. 1.
Methods of classifying waveforms: classic (manual) spike-sorting and our neural network spike classifier, Not A Sorter (NAS). A: spike-sorted channels with waveforms that were manually classified as spikes and noise. The network was trained on 24,810,795 spike-sorted neural waveforms from 4 monkeys. The waveforms were recorded on arrays implanted in V4 as well as U-Probes placed in the frontal eye field. B: neural network structure and output for 3 sample waveforms. Each s = 52 waveforms input (I) was passed through a hidden layer (II) with n = 50 units. The resultant linear weighting of the waveform voltages was passed through a rectified linear unit (ReLU) nonlinearity (III). The output was again passed through a weighted sum (IV) followed by a sigmoid nonlinearity (V). The resulting value was the network’s assessment of the likelihood that the input waveform was a spike waveform (VI). We refer to this value as P(spike) or the “probability” of being a spike.
Fig. 2.
Fig. 2.
Off-line decoding of planned direction from a memory-guided saccade task. A: memory-guided saccade task. The monkey fixated on a central point. A brief stimulus flash occurred, followed by a delay period. When the fixation point turned off, the subject was required to make a saccade to the location of the previously flashed stimulus. B: decoding paradigm. The stimulus flash could occur at 8 different angles around the fixation point. A Poisson naive Bayes classifier was used to decode stimulus direction off-line using spikes recorded from a 96-electrode Utah array in prefrontal cortex 50 ms after target offset. For each recording session, we used 5-fold cross-validation, where for each fold the data were split (step 1) into a training set to create model distributions for each direction (step 2) and an independent testing set to test the accuracy of the model’s predictions (step 3). Note that the curves in step 2 do not depict actual distributions and simply represent how a Poisson decoder could use spike counts from trials in the training set to distinguish between different target conditions.
Fig. 3.
Fig. 3.
Classifying waveforms based on their probability of being a spike, P(spike), by setting γ, a tunable parameter. A and B: waveforms classified as spikes or noise for a sample channel in monkey Pe. The network outputs a value between 0 and 1, referred to as P(spike), for each waveform, where a value close to 1 means the network identifies that waveform as very likely to be a spike waveform. After running waveforms through the network, we set the minimum P(spike) to classify waveforms as spikes and referred to this value as the γ-threshold. Only waveforms assigned a spike probability > 0.20 (i.e., γ-threshold = 0.20) in A and > 0.70 (i.e., γ-threshold = 0.70) in B were classified as spikes. Increasing the γ-threshold by definition results in a smaller percentage of waveforms captured in the spike class. C: waveforms from the same channel in A and B colored based on their network-assigned P(spike) value. For a waveform where γ1 < P(spike) < γ2, the waveform would be classified as a spike when the threshold is γ1 but would be labeled as noise for γ2. D: similar to C except for the average of waveforms across all channels within the indicated P(spike) ranges. Modifying the γ-threshold tuned the stringency of the spike classifications. For the channel depicted in A–C the standard deviation of the waveform noise, computed with the method described in Kelly et al. (2007), was 17.1 μV.
Fig. 4.
Fig. 4.
Using Not A Sorter (NAS) spike classifications improved decoding accuracy in many sessions. A and B: % decoding accuracy (black line) and % of waveforms removed (maroon line) at different γ-thresholds for an example recording session in monkeys Pe (A) and Wa (B). Chance decoding accuracy was 12.5% (verified by computing a decoding control with shuffled test trials, gray line). The decoding accuracy increased for low γ-thresholds and then reached an asymptote as γ increased. At the highest γ-thresholds, decoding accuracy fell to chance (gray line). Other labeled relevant metrics include decoding accuracy with threshold crossings (blue dot), maximum decoding accuracy (green dot), γ-threshold with the maximum decoding accuracy (gray dotted line), and Δ % decoding accuracy (the difference for a given session between the decoding accuracy using the network classifications at a particular γ-threshold and the decoding accuracy with threshold crossings). C and D: distribution of γ-thresholds across sessions [monkey Pe (C): n = 36, monkey Wa (D): n = 16] that resulted in the maximum decoding accuracy for each session. E and F: distribution of Δ % decoding accuracy across all sessions where the γ-threshold was the median from the distributions in C and D. Mean Δ % decoding accuracy is shown in red. For both monkeys, using spikes classified by the network improved decoding accuracy on average across sessions; however, this improvement was only statistically significant for monkey Pe [2-tailed Wilcoxon-signed rank test, monkey Pe (E): P < 0.0001, monkey Wa (F): P = 0.057].
Fig. 5.
Fig. 5.
Noise on the array increased with the age of the array while decoding accuracy decreased in monkey Pe and monkey Wa. A: % of waveforms with a P(spike) < 0.02 over time. A waveform with a P(spike) < 0.02 was one that the network found very unlikely to be a spike. The percentage of these unlikely spike waveforms increased as the array became older (Spearman’s correlation, monkey Pe: ρ = 0.87, P < 0.0001; monkey Wa: ρ = 0.90, P < 0.0001). B: % of waveforms with a P(spike) > 0.70 over time. The percentage of waveforms that the network found to be strongly spikelike decreased as the array became older (Spearman’s correlation, monkey Pe: ρ = −0.87, P < 0.0001; monkey Wa: ρ = −0.94, P < 0.0001). C: decoding accuracy with threshold crossings (i.e., γ = 0) decreased as the array aged (Spearman’s correlation, monkey Pe: ρ = −0.86, P < 0.0001; monkey Wa: ρ = −0.69, P = 0.004). D: change in % decoding accuracy with network-classified spikes relative to decoding accuracy with threshold crossings (Δ % decoding accuracy). We computed a distribution of the maximum γ-threshold (similar to Fig. 4, C and D) for sessions that were 0–50 days after array implant and used the median to set the γ-threshold before computing decoding accuracy for those sessions. We repeated this for sessions >50 days after array implant. In monkey Pe using Not A Sorter (NAS) classifications improved decoding accuracy (2-tailed Wilcoxon signed-rank test, P < 0.0001), and in monkey Wa using the classifications neither hurt nor helped decoding significantly (P = 0.09). In both subjects, the network helped decoding more in the late array sessions (>50 days after implant) compared with the early sessions (2-tailed Wilcoxon rank sum, monkey Pe: P = 0.01; monkey Wa: P = 0.01). E: mean normalized decoding accuracy across early sessions (open circles) and late sessions (filled circles) as a function of γ-threshold. Shading represents ±1 SE. Using the network classifications at any γ-threshold > 0 was more helpful for late sessions than it was for early sessions.
Fig. 6.
Fig. 6.
Using Not A Sorter (NAS) classifications was comparable to using spike-sorted data for decoding. Δ % decoding accuracy was calculated for both NAS classifications and spike-sorted waveforms as the change from decoding accuracy with threshold crossings. Top: distribution of Δ % decoding accuracy using NAS classifications aggregated across subjects (γ-threshold selected as in Fig. 5D). Using NAS classifications improved decoding accuracy from that with threshold crossings (2-tailed Wilcoxon signed-rank test, P < 0.0001). Right: distribution of Δ % decoding accuracy using manual spike-sorting aggregated across subjects. Using spike-sorted classifications also improved decoding accuracy from that with threshold crossings (2-tailed Wilcoxon signed-rank test, P < 0.0001). Center: the joint distribution of Δ % decoding accuracy with spike-sorting- and NAS-classified spikes. Using our network’s classifications was at least as helpful as spike-sorting for decoding (paired, 2-tailed Wilcoxon signed-rank test, monkey Pe: P = 0.75; monkey Wa: P = 0.09).

Similar articles

Cited by

References

    1. Abadi M, Agarwal A, Barham P, Brevdo E, Chen Z, Citro C, Corrado GS, Davis A, Dean J, Devin M, Ghemawat S, Goodfellow I, Harp A, Irving G, Isard M, Jia Y, Jozefowicz R, Kaiser L, Kudlur M, Levenberg J, Mane D, Monga R, Moore S, Murray D, Olah C, Schuster M, Shlens J, Steiner B, Sutskever I, Talwar K, Tucker P, Vanhoucke V, Vasudevan V, Viegas F, Vinyals O, Warden P, Wattenberg M, Wicke M, Yu Y, Zheng X. TensorFlow: large-scale machine learning on heterogeneous distributed systems. In: OSDI'16: Proceedings of the 12th USENIX Conference on Operating Systems ... Berkeley, CA: USENIX Association, 2016.
    1. Anastassiou CA, Perin R, Buzsáki G, Markram H, Koch C. Cell type- and activity-dependent extracellular correlates of intracellular spiking. J Neurophysiol 114: 608–623, 2015. doi:10.1152/jn.00628.2014. - DOI - PMC - PubMed
    1. Averbeck BB, Latham PE, Pouget A. Neural correlations, population coding and computation. Nat Rev Neurosci 7: 358–366, 2006. doi:10.1038/nrn1888. - DOI - PubMed
    1. Bishop W, Chestek CC, Gilja V, Nuyujukian P, Foster JD, Ryu SI, Shenoy KV, Yu BM. Self-recalibrating classifiers for intracortical brain-computer interfaces. J Neural Eng 11: 026001, 2014. doi:10.1088/1741-2560/11/2/026001. - DOI - PMC - PubMed
    1. Boulay CB, Pieper F, Leavitt M, Martinez-Trujillo J, Sachs AJ. Single-trial decoding of intended eye movement goals from lateral prefrontal cortex neural ensembles. J Neurophysiol 115: 486–499, 2016. doi:10.1152/jn.00788.2015. - DOI - PMC - PubMed

Publication types

LinkOut - more resources