Learnable latent embeddings for joint behavioral and neural analysis

Steffen Schneider*
Jin Hwa Lee*
Mackenzie Weygandt Mathis


Mapping behavioral actions to neural activity is a fundamental goal of neuroscience. As our ability to record large neural and behavioral data increases, there is growing interest in modeling neural dynamics during adaptive behaviors to probe neural representations. In particular, neural latent embeddings can reveal underlying correlates of behavior, yet, we lack non-linear techniques that can explicitly and flexibly leverage joint behavior and neural data. Here, we fill this gap with a novel method, CEBRA, that jointly uses behavioral and neural data in a hypothesis- or discovery-driven manner to produce consistent, high-performance latent spaces. We validate its accuracy and demonstrate our tool's utility for both calcium and electrophysiology datasets, across sensory and motor tasks, and in simple or complex behaviors across species. It allows for single and multi-session datasets to be leveraged for hypothesis testing or can be used label-free. Lastly, we show that CEBRA can be used for the mapping of space, uncovering complex kinematic features, and rapid, high-accuracy decoding of natural movies from visual cortex.

CEBRA embedding visualizations and decoding

Application of CEBRA-Behavior to rat hippocampus data (Grosmark and Buzsáki, 2016), showing position/neural activity (left), overlayed with decoding obtained by CEBRA. The current point in embedding space is highlighted (right). CEBRA obtains a median absolute error of 5cm (total track length: 160cm; see pre-print for details). Video is played at 2x real-time speed.

CEBRA applied to mouse primary visual cortex, collected at the Allen Institute (de Vries et al. 2020, Siegle et al. 2021). The left panels show example calcium traces from 2-photon imaging (top) and spikes from Neuropixels recording (bottom) while the video (far right) is presented to mice. The center panel shows an embedding space constructed by jointly training a CEBRA-Behavior model with 2-photon and Neuropixels recordings using DINO frame features as labels. The colored trace is an embedding of a held-out test repeat from Neuropixels data. The colormap indicates frame number of the 30 second long video (30 Hz). The last panels show true video (top) and the predicted frame sequence (bottom) using a kNN decoder on the CEBRA-Behavior embedding from the test set.


The pre-print is available on arxiv now: arxiv.org/abs/2204.00673.


Our official implementation of the CEBRA algorithm will be released on GitHub upon publication of the paper. Watch and Star the repository to be notified of updates and code release dates. You can also follow us on Twitter or subscribe to our mailing list for updates on the project and release timeline.

If you are interested in collaborations and/or early access, please contact us via email.


Please cite our pre-print as follows:

  author = {Schneider, Steffen and Lee, Jin H and Mathis, Mackenzie W},
  title = {Learnable latent embeddings for joint behavioral and neural analysis},
  journal = {CoRR},
  volume = {abs/2204.00673},
  year = {2022},
Webpage designed using Bootstrap 5 and Fontawesome 5.