Abstract
Neuroscience has long focused on finding encoding models that effectively ask “what predicts neural spiking?” and generalized linear models (GLMs) are a typical approach. It is often unknown how much of explainable neural activity is captured, or missed, when fitting a GLM. Here we compared the predictive performance of GLMs to three leading machine learning methods: feedforward neural networks, gradient boosted trees (using XGBoost), and stacked ensembles that combine the predictions of several methods. We predicted spike counts in macaque motor (M1) and somatosensory (S1) cortices from standard representations of reaching kinematics, and in rat hippocampal cells from open field location and orientation. In general, the modern methods (particularly XGBoost and the ensemble) produced more accurate spike predictions and were less sensitive to the preprocessing of features. This discrepancy in performance suggests that standard feature sets may often relate to neural activity in a nonlinear manner not captured by GLMs. Encoding models built with machine learning techniques, which can be largely automated, more accurately predict spikes and can offer meaningful benchmarks for simpler models.
Introduction
A fundamental goal in systems neuroscience is to understand the relationship between external stimuli—such as movement, sensory input, or spatial location—and the firing patterns of neurons. This is typically achieved through "encoding models," which attempt to predict a neuron's spike count based on these external variables. For decades, the Generalized Linear Model (GLM) has served as the standard tool for this task. Its popularity stems from its mathematical transparency, ease of optimization, and the clear, interpretable "tuning curves" it produces.
However, the GLM relies on a significant simplification: it assumes that a neuron integrates inputs linearly before passing the result through a static nonlinearity. If the underlying biological relationship is multidimensional or involves complex interactions between features, the GLM may fail to capture the full extent of the information present. To compensate, researchers often engage in extensive "feature engineering"—manually transforming raw data into formats that are more compatible with linear assumptions. This study investigates whether modern machine learning (ML) techniques can automate this process and provide more accurate predictions of neural activity.
Methods and Models
The study compared the traditional Poisson GLM against three modern machine learning architectures:
- Feedforward Neural Networks (NN): A standard deep learning approach utilizing two hidden layers and Rectified Linear Unit (ReLU) activations to capture nonlinearities.
- Gradient Boosted Trees (XGBoost): An ensemble method that builds decision trees sequentially. Each new tree is designed to correct the residual errors of the previous ones, making it highly effective for tabular data.
- Stacked Ensembles: A "meta-model" that aggregates the predictions of the GLM, NN, and XGBoost to produce a single, optimized output.
- Long Short-Term Memory (LSTM): A recurrent neural network used specifically for analyses involving temporal history (past spikes and movement trajectories).
To evaluate these models, the researchers employed pseudo-$R^2$. Unlike standard $R^2$, which assumes Gaussian noise, pseudo-$R^2$ is specifically formulated for Poisson-distributed data, making it a more appropriate metric for discrete spike counts.
Experimental Datasets
To ensure the findings were robust across different brain regions and functions, the models were tested on three distinct datasets:
- Macaque Motor Cortex (M1): 82 neurons recorded during a "center-out" reaching task, where the goal is to predict spikes from hand kinematics.
- Macaque Somatosensory Cortex (S1): 52 neurons recorded during a "random-pursuit" reaching task.
- Rat Hippocampus (CA1): 58 neurons recorded while the animal foraged in an open field, focusing on the relationship between spatial location/orientation and "place cell" firing.
Key Findings
ML as a Nonlinearity Detector
The most significant finding was that ML models consistently outperformed GLMs, even when the GLM was provided with "perfect" hand-engineered features. This suggests that existing models of neural tuning curves are likely missing complex, nonlinear structures that modern ML can identify.
Automation and Robustness
One of the primary advantages of ML models is their lack of sensitivity to data preprocessing. When provided with raw, un-transformed data (such as raw velocity in radians), the GLM's performance plummeted. In contrast, XGBoost and the ensemble models reached peak performance regardless of data formatting, effectively performing their own feature engineering.
Furthermore, XGBoost proved to be a particularly robust "workhorse." While Neural Networks occasionally struggled with the extremely low firing rates observed in the rat hippocampus (median 0.2 spikes/s), XGBoost remained consistently effective across all datasets.
Performance Benchmarks
- M1 Cortex: The ensemble method achieved nearly double the predictive performance of the GLM (a ratio of 1.8), even after the GLM was optimized with engineered features.
- S1 Cortex: ML methods outperformed the GLM in 49 out of 52 recorded neurons.
- Hippocampus: Many neurons that appeared "unpredictable" to a GLM (pseudo-$R^2$ near zero) were revealed to be highly predictable by XGBoost (pseudo-$R^2$ > 0.2), suggesting the GLM fundamentally mischaracterized the spatial tuning of these cells.
Discussion and Limitations
The primary challenge in adopting these high-performance models is the trade-off with interpretability. While a GLM provides a clear weight for every input, a stacked ensemble or a deep neural network is often viewed as a "black box." Although techniques like LIME (Local Interpretable Model-Agnostic Explanations) offer a glimpse into model logic, the field currently lacks a standardized method for translating an XGBoost model into a simple biological rule.
However, the authors argue that ML models should serve as a "performance ceiling." By establishing the maximum amount of explainable variance in a dataset, researchers can determine if their simpler, more interpretable models are capturing all available information or if significant biological mechanisms remain unaccounted for.
Conclusion
Modern machine learning offers a powerful, automated alternative to traditional encoding models. By reducing the reliance on manual feature engineering and providing more accurate spike predictions, these tools allow neuroscientists to more effectively benchmark their findings and uncover the complex nonlinearities inherent in neural computation.
Summary updated