Machine learning for neural decoding

Joshua I. Glaser, Raeed H. Chowdhury, Matthew G. Perich, Lee E. Miller, Konrad P. Körding

Abstract

Despite rapid advances in machine learning tools, the majority of neural decoding approaches still use traditional methods. Modern machine learning tools, which are versatile and easy to use, have the potential to significantly improve decoding performance. This tutorial describes how to effectively apply these algorithms for typical decoding problems. We provide descriptions, best practices, and code for applying common machine learning methods, including neural networks and gradient boosting. We also provide detailed comparisons of the performance of various methods at the task of decoding spiking activity in motor cortex, somatosensory cortex, and hippocampus. Modern methods, particularly neural networks and ensembles, significantly outperform traditional approaches, such as Wiener and Kalman filters. Improving the performance of neural decoding algorithms allows neuroscientists to better understand the information contained in a neural population and can help advance engineering applications such as brain machine interfaces.

Introduction

Neural decoding—the process of predicting external variables like limb movement or spatial location from recorded brain activity—is a cornerstone of neuroscience and the primary engine for Brain-Machine Interfaces (BMIs). While machine learning (ML) has revolutionized many fields, neuroscience has largely remained tethered to 20th-century linear methods like Wiener and Kalman filters. These traditional tools are favored for their simplicity and interpretability but often fail to capture the complex, non-linear, and temporal dynamics of neural populations. This paper presents a modern upgrade, demonstrating that contemporary ML algorithms, particularly recurrent neural networks (RNNs), offer significant performance gains while remaining practical for standard research workflows.

Methodology and Datasets

The study evaluates a spectrum of decoding algorithms across three distinct neural datasets to ensure generalizability:

  1. Motor Cortex (M1): Decoding velocity from 164 neurons in a macaque monkey.
  2. Somatosensory Cortex (S1): Decoding hand velocity from 52 neurons in a macaque monkey.
  3. Hippocampus (HC): Decoding spatial position from 46 neurons in a foraging rat.

Decoding Architectures

The authors categorize decoders into non-recurrent and recurrent architectures. Non-recurrent models, such as the Wiener Filter, XGBoost, and Feedforward Neural Networks (FNN), treat each time bin as an independent observation. In contrast, recurrent models like LSTMs and GRUs maintain an internal hidden state, allowing them to integrate information over time.

Overview of non-recurrent and recurrent decoding pipelines, including training and evaluation phases.

To ensure robust results, the authors utilized nested cross-validation and Bayesian optimization for hyperparameter tuning, establishing a rigorous pipeline for benchmarking these diverse models.

Key Results

The primary performance metric was the fraction of variance accounted for ($R^2$). Modern ML methods consistently outperformed traditional filters across all datasets.

  • Performance Gains: In the M1 dataset, the LSTM achieved an $R^2$ of 0.88, a substantial improvement over the Wiener Filter's 0.78. This represents a 45% reduction in unexplained variance.
  • Temporal Integration: The superior performance of RNNs (LSTMs and GRUs) highlights the importance of "memory" in neural decoding. Capturing the history of neural activity is crucial for accurate behavioral prediction.
  • Data Efficiency: Contrary to the belief that deep learning requires massive datasets, these models outperformed traditional methods with as little as one to two minutes of training data.
  • Ensemble Modeling: A "meta-model" ensemble, which combines predictions from multiple decoders, provided a consistent boost in accuracy by leveraging the strengths of different algorithmic assumptions.

Discussion and Future Directions

While modern ML offers clear predictive advantages, the authors note several considerations for researchers. First, there is a trade-off between predictive power and interpretability; linear models may still be preferable for simple mechanistic descriptions. Second, the current study focuses on "offline" decoding. The transition to "online," closed-loop BMI applications—where the brain adapts to the decoder—remains a critical area for future research.

Despite these considerations, the robustness and efficiency of modern ML tools make them highly accessible. With training times for complex models like LSTMs remaining under ten minutes on standard hardware, the barrier to entry for neuroscientists is lower than ever. The authors provide an open-source Python package to facilitate this transition, encouraging the field to adopt these high-performance tools for both basic science and clinical applications.

Summary updated

BibTeX
@inproceedings{glaser2020machine,
  author = {Joshua I. Glaser and Raeed H. Chowdhury and Matthew G. Perich and Lee E. Miller and Konrad P. Körding},
  title = {{Machine learning for neural decoding}},
  booktitle = {eNeuro},
  year = {2020},
  doi = {10.1523/eneuro.0506-19.2020},
}
Figure