{'fraction_non_alphanumeric': 0.03961456102783726, 'fraction_numerical': 0.003747323340471092, 'mean_word_length': 5.172907488986784, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
BAYESIAN LATENT STATE SPACE MODELS OF NEURAL ACTIVITY

Latent state space models such as linear dynamical systems and hidden Markov models are extraordinarily powerful tools for gaining insight into the latent structure underlying neural activity. By beginning with simple hypotheses about the latent states of neural populations and incorporating additional beliefs about the nature of this state and its dynamics, we can compose a nested sequence of increasingly sophisticated models and evaluate them in a statistically rigorous manner. Unfortunately, inferring the latent states and parameters of these models is particularly challenging when presented with discrete spike counts, since the observations are not conjugate with latent Gaussian structure. Thus, we often resort to model-specific approximate inference algorithms which preclude rapid model iteration and typically provide only point estimates of the model parameters. As a result, it is difficult compare models in a way that is robust to the approximation and the particular estimates of the model parameters. Here, we develop a unified framework for composing latent state space models and performing efficient Bayesian inference by leveraging a data augmentation strategy to handle the discrete spike count observations. This framework is easily extensible, as we demonstrate by developing an array of latent state space models with a variety of discrete spike count distributions and fitting them to a simultaneously recorded population of hippocampal place cells. Our Bayesian approach yields a posterior distribution over latent states and parameters, which enables robust prediction and principled model comparison. Moreover, we show that our method is at least as fast as alternative approaches in real-world settings. 1. Latent State Space Models. Neural recordings often take the form of a matrix of observed spike counts, S, whose entries, sn,t, denote the number of spikes emitted by neuron n at time t. Depending on the recording, “neurons” may be replaced by voxels or features, and “spikes” may be replaced by fluorescence or another measurable signal. Latent state space models begin with the assumption that these observations are a noisy function of some unobserved instantaneous “activation,” ψn,t, and then hypothesize various models for how the activation is coupled across neurons and time. For example, principal components analysis (PCA) corresponds to the hypothesis that the activation is well modeled as,ψt = Cxt, where xt represents a low dimensional state at time t, and C is a linear mapping from latent states to activations. This corresponds to the hypothesis that spike counts are often correlated across neurons. Linear dynamical systems (LDS’s) extend PCA by modeling how the latent states evolve over time. Specifically, an LDS assumes, xt ∼ Axt−1 + t, where the matrix A specifies the linear dynamics and t represents Gaussian noise. This captures the temporal correlations in spike counts. Hidden Markov models (HMM’s) characterize population activity in terms of a discrete latent state zt ∈ {1, . . . ,K}, each of which corresponds to a different activation vector, ψ. Then, the instantaneous activation is ψt = ψ t. This may be an appropriate model for populations that switch between “on” and “off” states, for example. Combining HMM’s and LDS’s, we arrive at a switching linear dynamical system (SLDS) model with both continuous and discrete latent states. When in discrete state, zt, the continuous state, xt, is governed by dynamics matrix, A t. Though the instantaneous dynamics are always linear, switching between these discrete latent states allows us to model complex, nonlinear dynamics of the neural population. From this perspective, it is clear that these seemingly disparate models are really special cases of one another, and they correspond to a sequence of models that encode increasingly sophisticated hypotheses about the latent structure underlying neural activity. When the observed signal is well modeled by a Gaussian distribution, the conditional distribution over continuous latent states, xt, is Gaussian and can be computed in closed form, and we can leverage a host of off-the-shelf inference algorithms. However, when modeling discrete spike counts, a Bernoulli, Poisson model is more appropriate. In cases where the spike counts are overdispersed, a negative binomial model may provide an even better fit. Unfortunately, these discrete models are not conjugate with the Gaussian latent states and inference is considerably more complicated. Substantial work has gone into developing approximate inference algorithms for such models (Macke et al., 2011), but these methods rely on approximations to the model. Though these approximations are fast and effective in practice, they yield asymptotically biased inferences. Moreover, they often provide only a point estimate of the latent states and parameters, which does not permit robust model comparison. Here, we present a simpler, fully-conjugate alternative. 2. Bayesian Inference. Consider a Bernoulli observation model, p(sn,t |ψn,t) = Bern(sn,t |σ(ψn,t)). Dropping the dependence on n and t for notational convenience, this likelihood is equal to, p(s |ψ) = c(s) (e) (1 + eψ)−b(s), where a(s) = s, b(s) = 1, and c(s) = 1. Polson, Scott and Windle (2013) have developed an elegant strategy for performing inference in models with likelihoods of this form. Their strategy leverages the following integral identity, (1) p(ψ, s) = p(ψ) c(s) (e) (1 + eψ)b(s) = ∫ ∞ 0 p(ψ) c(s) 2−b(s)eκ(s)ψe−ωψ /2 PG(ω | b(s), 0) dω,