Abstract
Recordings from large neural populations are becoming an increasingly popular and accessible method in experimental neuroscience. While the activity of individual neurons is often too stochastic to interrogate circuit function on a moment-by-moment basis, multi-neuronal recordings enable us to do so by pooling statistical power across many cells. For example, groups of neurons often exhibit correlated gain or amplitude modulation across trials, which can be statistically formalized in a tensor decomposition framework. Additionally, the time course of neural population dynamics can be shifted or stretched/compressed, which can be modeled by time warping methods. Here, I describe how these two modeling frameworks can be combined and show that doing so can be highly advantageous for practical neural data analysis. Specifically, the presence of random time shifts hampers the performance and interpretability of tensor decomposition, while a time-shifted variant of this model corrects for these disruptions and uncovers ground truth structure in simulated data.
Introduction: The Challenge of Neural Variability
Neuroscientists often record from hundreds of neurons simultaneously across many experimental trials. To extract meaningful patterns from this high-dimensional data, researchers look for coordinated population activity. However, two major types of variability complicate this analysis:
- Amplitude/Gain Modulation: A sub-population of neurons may fire more or less intensely from trial to trial, reflecting changes in engagement or physiological state.
- Timing/Latency Shifts: The entire population's response may be delayed or advanced (e.g., by milliseconds) due to internal states like attention or rhythmic processes like breathing.
Standard Tensor Component Analysis (TCA) is effective at capturing gain changes but is extremely sensitive to timing misalignments. Conversely, traditional time warping methods align trials but typically assume a global shift for all neurons. This paper bridges the gap by allowing different sub-populations to possess unique timing and amplitude dynamics.
Methodology: Time-Shifted Models
The proposed framework introduces two primary extensions to existing models:
- Time-Shifted Tensor Decomposition: This builds on the Canonical Polyadic (CP) model, representing neural activity as a sum of components. Each component includes a neuron factor (membership), a trial factor (participation per trial), and a temporal factor (firing pattern). Two new parameters are added: a per-neuron shift (\alpha) and a per-trial shift (\beta).
- Multi-Shift Model: This flexible version of time warping allows for multiple "templates" or ensembles that can be independently modulated in amplitude and shifted in time.
The models are optimized using Hierarchical Alternating Least Squares (HALS) for the factors and a randomized coordinate descent for the shift parameters. A quadratic (least-squares) loss function is employed to ensure computational efficiency, making it significantly faster than Poisson-based alternatives.
Validation and Results
The models were validated using synthetic spike train data (60 neurons, 200 trials) containing two non-overlapping neural ensembles with random per-trial time shifts of \pm 15%.
The "High-Rank" Trap
A key insight is that without accounting for shifts, standard TCA perceives simple time-shifted data as having a "high-rank" structure. It attempts to compensate for misalignment by adding redundant components, which obscures the true underlying circuit structure and ruins model interpretability.
Recovery of Latent Structure
In simulations where vanilla TCA failed, the time-shifted model successfully recovered the ground truth ensembles, their trial-by-trial gain changes, and their temporal firing patterns. The model demonstrated high stability—consistently converging to the same solution across random initializations—which serves as a reliable heuristic for identifying the correct model complexity (R).
Conclusion and Future Directions
The time-shifted tensor decomposition provides a robust framework for uncovering latent structures in stochastic neural data. While the current implementation uses a quadratic loss for speed, future work may explore Poisson likelihoods for extremely low-count data. Additionally, incorporating periodic boundary conditions could extend the model's utility to rhythmic behaviors like locomotion or respiration.
The open-source Python implementation is available at https://github.com/ahwillia/tensortools.
Summary updated