## Abstract

Neurons in many brain areas exhibit high trial-to-trial variability, with spike counts that are over-dispersed relative to a Poisson distribution. Recent work (Goris et al., 2014) has proposed to explain this variability in terms of a multiplicative interaction between a stochastic gain variable and a stimulus-dependent Poisson firing rate, which produces quadratic relationships between spike count mean and variance. Here we examine this quadratic assumption and propose a more flexible family of models that can account for a more diverse set of mean-variance relationships. Our model contains additive Gaussian noise that is transformed nonlinearly to produce a Poisson spike rate. Different choices of the nonlinear function can give rise to qualitatively different mean-variance relationships, ranging from sub-linear to linear to multiplicative. Intriguingly, a rectified squaring nonlinearity produces a linear mean-variance function, corresponding to responses with constant Fano factor. We describe a computationally efficient method for fitting this model to data, and demonstrate that a majority of neurons in a V1 population are better described by a model with non-quadratic relationship between mean and variance. Lastly, we develop an application to Bayesian adaptive stimulus selection in closed-loop neurophysiology experiments, which shows that accounting for overdispersion can lead to dramatic improvements in adaptive tuning curve estimation.

## 1 Introduction

Quantifying neural variability is crucial for understanding how neurons process and transmit information. This has motivated a large body of work that seeks to characterize the signal and noise governing neural responses to sensory stimuli. A simple but popular approach to this problem models neural spike counts using the Poisson distribution. Under this model, spike count mean and variance are equal. Deviations from this relationship are often characterized by the Fano factor, defined as the ratio of the spike-count variance to the mean (Geisler & Albrecht, 1997; Eden & Kramer, 2010; Shadlen & Newsome, 1998). The Fano factor for a Poisson neuron is therefore equal to one. A Fano factor less than one indicates sub-Poisson variability, a condition referred to as “under-dispersion”; a Fano factor greater than one, on the other hand, indicates greater-than-Poisson variability, commonly known as “over-dispersion”. A substantial literature has shown that Fano factors in a variety of different brain areas differ substantially from 1 (Shadlen & Newsome, 1998; Gur et al., 1997; Barberini et al., 2001; Baddeley et al., 1997; Gershon et al., 1998). Recent work has shown that, not only do neural responses not obey a Poisson distribution, the overall mean-variance relationship is often not well characterized by a line, meaning the data are not consistent with a single Fano factor (Pillow & Scott, 2012b; Gao et al., 2015; Stevenson, 2016; Goris et al., 2014; Wiener & Richmond, 2003; Moshitch & Nelken, 2014). Rather, the spike count variance changes nonlinearly with mean.

Here we develop a flexible model for over-dispersed spike count data that captures a variety of different nonlinear mean-variance relationships. Our approach extends recent work from Goris et al. (2014), which described over-dispersed spike responses in the early visual pathway using a Poisson model with multiplicative noise affecting the trial-to-trial spike rate. This produces a quadratic relationship between mean and variance, so Fano factor increases monotonically with mean spike count.

By contrast, our model seeks to describe a more diverse range of mean-variance relationships while maintaining tractability for simulation and fitting. Our model, which we refer to as the *flexible over-dispersion model*, consists of a stimulus-dependent term, additive Gaussian noise, a point nonlinearity, and conditionally Poisson spiking (see Fig. 1). This framework includes the multiplicative Goris model as a special case when the nonlinearity is exponential, but includes the flexibility to exhibit other behaviors as well: for example, Fano factors that decrease with increasing spike rate, which arises for a rectified-linear nonlinearity, and constant slope linear relationships, corresponding to a constant Fano factor, which arises for a rectified squaring nonlinearity. We show that the model can be tractably fit to data using the Laplace approximation to compute likelihoods, and requires fewer parameters than other models for non-Poisson spike count data such as the modulated binomial or generalized count models (Gao et al., 2015; Stevenson, 2016). We apply our model to the V1 dataset presented in Goris et al. (2014) and show that a rectified power-law nonlinearity provides a better description of most individual neurons than a purely multiplicative model.

Lastly, we develop an application to adaptive stimulus selection in closed-loop experiments, also known as “active learning”, for characterizing multi-dimensional tuning curves. These methods seek to minimize the amount of time required to estimate tuning curves by selecting stimuli that are as useful or informative as possible about the tuning curve. We use the flexible over-dispersion model in place of the standard Poisson model and demonstrate a marked improvement for tuning curve estimation, both for simulated experiments, as well as for color-tuning maps in awake fixating monkeys.

## 2 Background: Fano factor and the modulated Poisson model

A popular model of neural responses uses the Poisson distribution to describe stimulusevoked spike counts (Brillinger, 1988; Chichilnisky, 2001; Simoncelli et al., 2004; Paninski, 2004). The basic model specifies a stimulus-dependent spike rate *λ*(**x**) that drives Poisson firing. If we express *λ*(**x**) in units of spikes/bin, the probability of observing *r* spikes in a bin is given by:

This model makes the strong assumption that the mean and variance are equal: var[*r*] = 𝔼[*r*] = *λ*(**x**), for any stimulus **x**. A sizeable literature has shown assumption is often inaccurate, as spike counts in many brain areas exhibit over-dispersion relative to the Poisson distribution, meaning that variance exceeds the mean (Shadlen & Newsome, 1998; Gur et al., 1997; Barberini et al., 2001; Pillow & Scott, 2012b; Gao et al., 2015; Goris et al., 2014; Stevenson, 2016; Baddeley et al., 1997; Gershon et al., 1998; Tolhurst et al., 1983; Buracas et al., 1998; Carandini, 2004).

A common approach to the phenomenon of over-dispersion is to regard the Fano factor, *F* = var[*r*]*/*𝔼[*r*], as a constant that characterizes the generic degree of overdispersion in neural firing (Geisler & Albrecht, 1997; Shadlen & Newsome, 1998). However, this description is adequate only if spike count variance scales linearly with the mean. Recent work has shown that spike responses in four different early visual areas exhibit variance that grows super-linearly with the mean, meaning that overdispersion (and the Fano factor) increase with the firing rate, inconsistent with a single Fano factor (Goris et al., 2014). Moreover, the Fano factor falls short of providing a complete description of neural spike count statistics, as it does not specify a full probability distribution over spike counts. Such a description is necessary for quantifying information in neural population codes. In light of these shortcomings, we feel that the Fano factor should be set aside as the default statistic for characterizing neural overdispersion; rather, researchers should consider the full curve describing how variance changes as a function of mean.

A recently proposed model for over-dispersed spike counts in the early visual pathway is the *modulated Poisson* model, in which the stimulus-dependent Poisson spike rate is modulated by a multiplicative stochastic gain variable on each trial (Goris et al.,2014). The model can be written^{1}:
where *P _{G}
* is the distribution of a (unobserved) stochastic gain variable

*G*, which is assumed to have mean 𝔼[

*G*] = 1, and variance var(

*G*) = . The conditional distribution of the response given the stimulus requires marginalizing over

*G*: where Poiss(·)denotes the Poisson distribution (Eq. 1). When

*G*has a gamma distribution, this integral can be evaluated in closed form and results in a negative binomial distribution, a popular model for over-dispersed spike counts (Pillow & Scott, 2012b; Goris et al., 2014; Linderman et al., 2016). (See Appendix A for a derivation of this relationship).

For any choice of *P _{G}
*, the constraint 𝔼[

*G*] = 1 ensures that the gain variable has no effect on the marginal mean spike count, meaning that E[

*r*[

**x**] =

*λ*(

**x**) as in the pure Poisson model. However, the variance exhibits a quadratic dependence on the spike rate, which can be derived using the law of total variance:

If the gain variable variance
, meaning the gain variable is constant (*G* = 1), the model reverts to Poisson. However, for
it exhibits over-dispersion that increases with firing rate, with Fano factor given by

Goris et al. (2014) showed that this model provides a more accurate description of mean-variance relationships than the Poisson model for neurons from multiple visual areas (LGN, V1, V4 and MT). However, as we will show in the following, the quadratic relationship between variance and mean imposed by the Goris model does not accurately apply to all neurons.

## 3 The flexible over-dispersion model

Our flexible over-dispersion model for over-dispersed spike counts consists of a stimulus dependent term *g*(**x**), additive Gaussian noise *n*, and a nonlinear function *f* that transforms (*g*(**x**) + *n*) to a firing rate, followed by Poisson firing. Mathematically it can be written:
where *f* is a nonnegative, monotonically increasing nonlinearity that ensures nonnegative firing rates. The joint distribution over spike count and latent noise is therefore a product of Poisson and Gaussian distributions,

This flexible over-dispersion model can be interpreted in terms of a noisy sub-threshold membrane potential that is transformed by an output nonlinearity to drive Poisson spiking (c.f. Carandini (2004)). In this interpretation, *g*(**x**) is the stimulus tuning curve of the membrane potential,
is the variance of noise affecting in the membrane potential, and *f* (·) is a rectifying output nonlinearity that converts membrane potential to firing rate.

To obtain the probability of a spike count given the stimulus, we marginalize this distribution over the unobserved noise *n*:

Fig. 1 shows a diagram illustrating the model and several example choices for the non-linearity *f* (·).

The choice of nonlinearity *f* (·) allows the model the flexibility to produce different forms of over-dispersion, that is, mean-variance curves with different shapes. When *f* (·) is exponential, we recover the Goris model framework with multiplicative noise, since exp(*g*(**x**)+*n*) = exp(*g*(**x**)) exp(*n*), meaning the noise multiplicatively modulates with the stimulus-induced Poisson firing rate exp(*g*(**x**)). However, as we will show, other choices of *f* (·) lead to different over-dispersion curves from the quadratic meanvariance curve implied by multiplicative noise, as depicted in Fig. 2.

### 3.1 Spike count mean and variance

To characterize the over-dispersion quantitatively, we need to compute the spike count mean and variance as a function of the stimulus drive, or stimulus-induced membrane potential, which we denote *z* = *g*(**x**) for notational convenience. The mean spike count, which we denote *λ*(*z*), can be computed via the law of iterated expectations:
where
is the Gaussian distribution of the noise variable *n*.

The spike count variance, denoted
can be calculated using the law of total variance as
where the expectation in the last line is taken with respect to the Gaussian noise distribution *N* (0,
. When
= 0, the last two terms cancel and the model reverts to Poisson, with variance equal to the mean *λ*(*z*).

For arbitrary choices of *f*, the spike count mean and variance have no closed-form expression and must be computed by numerical integration. However, for several simple choices for *f* we can evaluate these quantities analytically or approximate them closely using the delta method. (See Table. 1).

### 3.2 Capturing different forms of over-dispersion

To illustrate the model’s flexibility, we consider several specific choices for *f*, namely exponential, and rectified power functions, *f* (*z*) = ⌊*z*⌋^{p} for *p* = {1/2, 1, 2}, where ⌊*z*⌋ = max(*z*, 0). Fig. 2 shows the different mean-variance relationships produced by these four different choices for *f*, at three different values of noise level
. This demonstrates simple nonlinear transforms that grow at different rates can capture important classes of behavior.

For concave nonlinearities like the rectified square-root, *f* (*z*) = ⌊*z*⌋^{0.5}, the spike count variance is actually larger at low spike rates than at high spike rates, and the Fano factor drops rapidly to 1 with increasing spike rate (Fig. 2, column 1). Such responses are thus highly over-dispersed at low spike counts but indistinguishable from Poisson at high spike counts. A linear-rectified nonlinearity, *f* (*z*) = ⌊*z*⌋, on the other hand, produces linear variance-mean curves with unit slope, but with a positive intercept that grows with noise variance
. Although they exhibit a constant degree of over-dispersion relative to Poisson, such neurons have falling Fano factor because the ratio of variance to mean is smaller at high firing rates (Fig. 2, column 2). Interestingly, a rectified squaring nonlinearity, *f* (*z*) = ⌊*z*⌋^{2}, gives rise to linear variance-mean curves with slopes that vary as a function of noise variance *σ*
^{2}. This is the only model of the four considered that generates constant Fano factor across spike rates (Fig. 2, column 3).

For the exponential nonlinearity, *f* (*z*) = exp(*z*), the spike count mean and variance can both be calculated analytically by exploiting the fact that exp(*n*) has a log-normal distribution (Table. 1). As noted above, this corresponds to the multiplicative noise setting considered by Goris et al. (2014), and exhibits variance that grows quadratically as a function of mean (Fig. 2, column 4). However, we will show in Sec. 5 that this model behaves very differently from the multiplicative model with a gamma-distributed gain variable (i.e., which produces negative-binomial distributed spike counts discussed in Goris et al. (2014)). This indicates that all multiplicative-noise models are not equal; differences in the distribution of the multiplicative noise variable can give rise to major differences in higher-order moments, which in turn can produce very different fits to data.

It is also worth noting that a model with latent Gaussian noise and exponential nonlinearity is also the default model considered in an extensive literature on factor or latent linear dynamical system models for multivariate spike count data (Macke et al., 2011; Buesing et al., 2012; Archer et al., 2014; Rabinowitz et al., 2015; Ecker et al., 2016; Gao et al., 2016; Zhao & Park, 2017). The majority of this literature, however, has focused on capturing covariance across time or across neurons, and has devoted less attention to the issue of how count variance grows with mean for single neurons.

While solutions given in Table 1 and Fig. 2 are useful for building intuition, in practice it makes sense to choose a parametrized function whose parameters can be adapted to capture a variety of different behaviors. For the general case *f* (*z*) = ⌊*z*⌋^{p}, *p >* 0, *p ≠* 1 we can use the delta method to derive the approximate variance as

Note that when
, this expression for the variance mimics the mean-variance relation achieved by the exponential nonlinearity (Table 1). Thus, for larger powers of *p >* 2, the rectification nonlinearity can reasonable approximate super-linear mean-variance relationships over the range of means *λ*(*z*) such that
^{−1}.

Additionally, as optimizing these parameters to fit neuron firing counts will require calculating various derivatives, a smooth function is also beneficial for stability in the fitting process. We find that a useful alternative to the rectified power function given above is the soft-rectification power function, i.e. a soft rectification raised to a power *p*:

By fitting both *p* and the unknown latent variance
, we find that this model is rich enough to capture a wide variety of over-dispersion behaviors.

Lastly, we note that despite *λ*(*z*) and
often requiring numerical integration to obtain, we can guarantee certain properties on the parametric curve, as parametrized by *z*. First, we can guarantee that both *λ*(*z*) and
are smooth functions of *z* (although the derivatives may be discontinuous). Second, so long as the function *f* (·) is positive and monotonically increasing, *λ*(*z*) is also a monotonically increasing function of *z*. This indicates that
can truly be considered a function of *λ*(*z*) since each value of *λ*(*z*) maps onto only one value of
. No similar guarantee could be made for
, however, indicating that local minima can exist in the mean-variance relation. Local minima occur when the function *f* (·) has regions that are concave and have small derivatives, as occurs for *f* (*z*) = ⌊*z*⌋ *
^{p}
* (see Fig. 2). In fact, if

*f*(·) were constructed to have multiple concave regions with small derivatives, multiple local minima and maxima could be present in the mean-variance relationship. Finally, we note that since 𝔼[

*f*

^{2}(

*z*+

*n*)]

*≥*𝔼[

*f*(

*z*+

*n*)]

^{2}, we always have

*≥ λ*(

*z*), indicating that while the amount of over-dispersion may vary significantly, out model always produces greaterthan-Poisson spike count variance.

## 4 Model fitting

In order to apply the flexible over-dispersion model to neural data, we need a tractable method for fitting the model parameters. Consider a dataset composed of a set of stimuli *X* = {**x**
_{i}} and the measured spike counts of a single neuron *R* = {*r _{ij}
*} where

*r*denotes the

_{ij}*j*’th response of the neuron to stimulus

**x**

_{i}, for

*i∈*{1, …,

*N*}. The model parameters

*θ*consist of a stimulus-dependent term for each stimulus, denoted

*z*=

_{i}*g*(

**x**

_{i}), the noise variance , and (optionally) the exponent

*p*governing the soft-rectification power nonlinearity. (We will consider the variable

*p*to stand for any parameters governing the nonlinearity, although for the exponential nonlinearity there are no additional parameters to fit).

The likelihood is given by a product of conditionally independent terms, one for each spike count:
where *θ* = {{*z _{i}
*},

*σ*

^{2},

*p*} is the full set of model parameters, and is the joint distribution of the spike count

*r*and latent noise

_{ij}*n*for the

_{ij}*j*’th response to stimulis

**x**

_{i}, which is given by a product of Poisson and Gaussian distributions (eq. 9).

Because the integral over the latent noise *n* is intractable, we compute the likelihood using the Laplace approximation. This method uses a surrogate Gaussian distribution to approximate the posterior of *n* given *r* around its mode:
where mean *n*
_{0} is the mode of *P* (*n|r, θ*), which we find via a numerical optimization of log *P* (*r, n|θ*) for *n*, and variance
is the inverse of the Hessian (2nd derivative) of the negative posterior log-likelihood,
evaluated at mode *n* = *n*
_{0}. If *f* is exponential, Equation (16) simplifies to
.

To evaluate the likelihood, we can replace the true posterior with the Laplace approximation to obtain a tractable form for the joint distribution, *P* (*r, n | θ*) *≈ P* (*r | θ*) *· P _{lapl}
*(

*n | r, θ*). We can then solve this expression for the desired likelihood, yielding: where the numerator is the exact joint probability of

*r*and

*n*given

*θ*, and the denominator is the approximation to the posterior over

*n*given

*r*. Evaluating the right-hand-side at

*n*=

*n*

_{0}(where the Laplace approximation is most accurate) gives the following expression for the likelihood:

Note that the parameters of the Laplace approximation, *n*
_{0} and
, are functions of *θ*, since they depend on numerical optimization of *P* (*n, r|θ*) for *n* at a given *θ*. Thus, maximum likelihood parameter estimation, which involves maximizing the log of Equation (14) for *θ*, requires we update these per-response parameters defining the Gaussian distribution for each noise term *n _{ij}
* given

*r*and

_{ij}*θ*every time we change

*θ*.

To demonstrate that this method yields an accurate approximation to the log-likelihood, we compare the true computed log-likelihood (via numerical integration) with the Laplace approximation. Fig. 3 depicts the log-likelihood landscapes for different spike counts (*r∈*{0, 2, 10, 50}) for both the numerically integrated log-likelihood and the Laplace approximation. The ratio between numerically computed and Laplace based log-likelihoods (rightmost column) demonstrates that errors are greatest at small spike counts (where the Poisson likelihood deviates most severely from Gaussian), but is negligible even in this regime for the exponential nonlinearity.

We can use the above methodology to now address the particular case where *f* (·) is the soft-rectification raised to a power
. With this nonlinearity, we obtain the update equations (see also Appendix B):
where *η* is the gradient descent step-size. For the case where *f* (·) is an exponential function, these expressions reduce further, and the full model fitting method is provided in Appendix B.

## 5 Results: V1 spike counts

To test the ability of the flexible over-dispersion model to capture the variability of real neurons, we fit to data collected from macaque primary visual cortex V1 (Graf et al., 2011) (one of the datasets considered in Goris et al. (2014)). This dataset contained five recording sessions with multi-electrode array recordings of neural population responses to 72 distinct visual grating orientations. A total of 654 neurons were recorded, and each orientation was presented 50 times. Trials consisted of drifting grating stimulus presentations for 1280ms, with a 1280ms rest period in between. From this dataset, we chose the 112 well-tuned neurons for model fitting. Well-tuned neurons were determined as in previous studies by applying a threshold to the difference between the minimum and maximum mean firing rate over all stimuli orientations (Graf et al., 2011).

We fit the model parameters using the Laplace-approximation based method described in Section 4, for both the soft-rectification-power function (“soft-rect-p”, eq. (13)) and the exponential nonlinearity. For comparison, we also fit the data with the negative-binomial (NB) model from (Goris et al., 2014). All model fits had 72 parameters {*z _{i}
*}t o describe the stimulus drive for each orientation and a noise variance parameter
, with the soft-rect-p model requiring an extra exponent parameter

*p*. Example mean-variance curves (as well as example draws from the model with the inferred parameters) are plotted against the true data in Fig. 4. While for some neurons the negative binomial model and our model resulted in near-identical mean-variance curves, for other neurons the flexibility of the soft-rectification function produced better qualitative fits. Fig. 5 depicts the range of mean-variance relationships inferred for a sampling of neurons in the data set. The range of curves observed for even this single data set implies that a single mean-variance relationship is insufficient to capture the entire range of neural variability. Fig. 5 further emphasizes this point by showing histograms of the inferred parameters (in the case of soft rectification this includes the latent noise standard deviation

*σ*and the soft-rectification power

_{n}*p*).

We quantified the performance of different models by comparing the Akaike Information Criterion (AIC) across all three fits (power soft-rectification, exponential, and negative binomial). The calculated AIC values, displayed as histograms in Fig. 6, demonstrate that the softrect-p model provided the best fit for the majority of neurons, achieving the highest AIC values for ≈83.4% of the 112 neurons analyzed. This result indicates that despite the AIC penalization for requiring an additional parameter, the softrect-p fit best modeled approximately ≈ 83% of the tuned V1 neurons in the Graf data set. Interestingly, we also note that the exponential nonlinearity model, a model commonly used as an inverse link function in machine learning and neuroscience (Nelder & Baker, 1972) was a *worse* model for 65.8% of the neurons according to AIC, even having performed worse than the NB model (as shown in Fig. 6). This result may seem contrary to the fact that the model with exponential nonlinearity belongs to the same class of multiplicative-noise models as the negative binomial and thus also exhibits a quadratic mean-variance curve. Fig. 4 demonstrates this behavior, showing that data fits to both quadratic models can still differ significantly in their curvature. The implication here is that while the full mean-variance curve may provide basic over-dispersion properties, it is insufficient to describe a neural spiking model. Specifically, model fitting with a full probabilistic model implies assumptions on higher-order moments that will effect the mean-variance curve fit.

To emphasize the potential insufficiency of the mean-variance curve as a model summary, Fig. 7 shows an example case where the exponential nonlinearity yielded a very different mean-variance curve than the negative binomial model, despite the fact that both are multiplicative noise models defined by a stochastic gain variable with a mean of 1. Specifically, for this neuron, both the exponential and NB models seem to have significantly over-estimated the variance as a function of the mean. The exponential fit over-estimation was so extreme that the curve for the exponential fit is barely visible in the mean-variance plot. After ruling out potential numerical or approximation error with the Laplace approximation technique, we observed that while the mean-variance curves did not match the data, the full count-distributions did seem to match the data. The upper-right and upper-left plots show that overall both models fit the data distributions for both high and low mean spike-counts. Plotting the spike-count distributions on a log-scale, however, shows that despite matching the data well at low firing rates, both models have higher tails than what would be expected. These heavy tails contributed directly to the over-fitting of the spike-count variance. In fact, the exponential nonlinearity’s spike-count distribution has a much heavier tail than even the NB model, correlating with how the exponential nonlinearity model nonlinearity modeled the variance to a higher degree. To understand why the erroneous fits were obtained, we observe that up to a certain value of spike counts, the tails of the data distribution do actually look heavy-tailed. In fact the log-distributions shown in the lower-left and lower-right panels of Fig. 7 do follow the data. Thus heavy tails stemmed from matching the data in the ML estimation. Unlike the data, however, our models are unbounded, indicating that heavy tails could impact the model variance calculations in ways that would not affect the data fits. This analysis demonstrates that attempting to fit the higher-order moment of the model (as ML-type methods do) may be detrimental to accurately fitting the mean-variance curve.

## 6 Application: adaptive closed-loop experiments

To illustrate one of the potential uses of the flexible over-dispersion model, we developed an application to adaptive stimulus selection for closed-loop neurophysiology experiments. Such methods, known as *active learning* in machine learning or *adaptive optimal experimental design* in statistics, seek to select stimuli based on the stimuli and responses observed so far during an experiment in order to characterize the neuron as quickly and efficiently as possible (Lindley, 1956; Bernardo, 1979; MacKay, 1992; Chaloner & Verdinelli, 1995; Cohn et al., 1996; Paninski, 2005). Adaptive stimulus selection is particularly useful in settings where data are limited or expensive to collect, and can substantially reduce in the number of trials needed for fitting an accurate model of neural responses (Paninski et al., 2007; Benda et al., 2007; Lewi et al., 2009; DiMattina & Zhang, 2011, 2013; Bölinger & Gollisch, 2012; Park & Pillow, 2012; Park et al., 2014; Pillow & Park, 2016).

Here we introduce a method for adaptive stimulus selection for estimating a neuron’s multi-dimensional tuning curve or “firing rate map” under the flexible over-dispersion model. Our method involves computing the posterior distribution over the tuning curve given the previously observed responses in an experiment, and selects the stimulus for which the value of the tuning curve has maximal posterior variance. We illustrate the performance gain using this adaptive learning method for estimating color tuning curves of V1 neurons recorded in awake, fixating monkeys (Park et al., 2014). For simplicity, we use the exponential nonlinearity *f* (*z*) = exp(*z*), which has the advantage of having analytic expressions for the mean and variance of the spike count given an input level *z* and noise variance
,

### 6.1 GP tuning curve model with flexible over-dispersion

Building on prior work (Rad & Paninski, 2010; Park et al., 2014; Pillow & Park, 2016), we model tuning curves by placing a GP prior over the input function *g*(**x**). Here *g*(**x**) can be considered log of the tuning curve plus a constant, since the tuning curve (expected spike count given a stimulus) for the exponential nonlinearity is
(Table 1).

The GP specifies a multivariate normal distribution over the input function values {*g*(**x**
_{1}), …, *g*(**x**
_{n})} at any finite collection of stimulus values *{*
**x**
_{1}, *…* **x**
_{n}}, namely:
where *m*(**x**) is the *mean function*, specifying the *a priori* mean of the function values, and *k*(**x**, **x**
^{/}) is the *covariance function*, specifying the prior covariance for any pair of function values *g*(**x**), *g*(**x**
^{/}). Here we use a zero mean function, *m*(**x**) = 0, and a Gaussian or *radial basis function* (RBF) covariance function
which is controlled by two hyperparameters: the marginal prior variance *ρ* and length scale *δ*. Increasing *ρ* increases the expected prior range of tuning curve values (i.e., increasing the spread between minimal to maximal log firing rates), while increasing *δ* increases its degree of smoothness. Functions *g*(·) sampled from a GP with this covariance function are continuous and infinitely differentiable.

We combine the GP prior with the likelihood from the flexible over-disperion model (eq. 9) to obtain a complete model for Bayesian adaptive stimulus selection. The complete tuning curve model can therefore be summarized:

The necessary steps in our stimulus selection algorithm include include updating the posterior over *g*(·) after each trial, updating hyperparameters using the Laplace approximation based marginal likelihood, and selecting the stimulus for which the tuning curve has maximal posterior variance.

### 6.2 Inference and Laplace approximation

The tuning curve inference problem here is similar to that of fitting the flexible overdispersion model (Sec. 4), except that we have added a prior over the values of *g*(**x**) that encourages smoothness and shrinks them toward zero. After each trial, we maximize marginal likelihood under the Laplace approximation to update the hyperparameters (*ρ, δ*) governing the GP prior’s scale and smoothness, as well as the noise variance
.

Let 𝒟_{t} = {**x**
_{1}, *r*
_{1}), *…*, (**x**
_{t}, r_{t})} denote the dataset after *t* trials, which is simply a paired list of stimuli and spike counts collected so far in the experiment. For the purposes of our derivation, let **z** = [*g*(**x**
_{1}), *…, g*(**x**
_{t})] denote the stimulus input values for the observed stimulus set **X** = [**x**
_{1}, *…*, **x**
_{t}], and let **n** = [*n*
_{1}, *…, n _{t}
*] and

**r**= [

*r*

_{1},

*…, r*] be the unobserved Gaussian input noise and observed spike counts on each trial, respectively.

_{t}The first step in the inference procedure is to maximize the log of the joint posterior over **z** and **n**, also known as the *total-data posterior*, after each trial:
where *P* (**z |**
*ρ, δ*) = (0, *K*) is the GP-induced Gaussian prior over the function values (eq. 24) with covariance matrix *K _{ij}
* =

*k*(

**x**

_{i},

**x**

_{j}), and is the distribution of the (unobserved) over-dispersion noise for each trial. The full set of hyperparameters is denoted

This optimization is simplified by considering a change of variables to take advantage of the fact that the Poisson likelihood relies only on the sums of *z _{i}
* +

*n*for each trial. Therefore, let us define: so that

_{i}**s**represents the total input to

*f*(·) on each trial, and the latent noise is now

**n**=

**s**–

**z**.

The total-data log posterior can now be written in terms of **s** and **z**:
where **1** is a length-*t* vector of ones, and *const* denotes constants that are independent of **s** and **z**. Note that the total-data log posterior is quadratic in **z**, meaning that the conditional maximum in **z** given **s** can be obtained analytically:

We can substitute this expression for **z** in (eq. 31) to obtain the profile likelihood:
which we can optimize efficiently to obtain the MAP estimate:

Note the vector **s** grows by one element after every trial, but this optimization can be made efficient by initializing the first *t −* 1 elements of the vector to its value from the previous trial. The joint optimum of the total data log-posterior can be obtained by plugging **s**
_{map} into (eq. 32) to obtain **z**
_{map}, and setting **n**
_{map} = **s**
_{map} – **z**
_{map}.

The Laplace approximation of the total-data posterior can then be computed as:
where the blocks of the inverse covariance come from the negative Hessians of the total-data log posterior:
where *L* = – **∇ _{z}∇ _{z}
** log

*P*(D

_{t}

**z**,

*|*

**n**) = diag[exp(

**z**+

**n**)] is a diagonal matrix with second derivatives from the Poisson term, all evaluated at

**z**=

**z**

_{map}and

**n**=

**n**

_{map}.

From the joint Gaussian posterior (eq. 35), we can compute the marginal posterior over **z**, the tuning curve inputs at the stimuli in our training set:

For stimuli not in our training set, denoted **x**
^{∗}, (e.g., candidate stimuli for the next trial), we can compute the marginal posterior distribution over the input value *z ^{∗}
* =

*g*(

**x**

^{∗}) using the Gaussian identities that arise in GP regression (Rasmussen & Williams, 2006): where where is the GP covariance function evaluated at the

*i*’th presented stimulus

**x**

_{i}and test stimulus

**x**

^{∗}.

### 6.3 Hyperparameter optimization

To optimize hyperparameters
governing the GP prior and the overdisperion noise, we use the Laplace approximation to compute the marginal likelihood:
evaluated at **z** = **z**
_{map} and **n** = **n**
_{map}, where the denominator is the Gaussian approximation to the posterior (eq. 35). This gives:
where **s**
_{map} = **z**
_{map} +**n**
_{map}, and *J* is the covariance matrix of the Laplace approximation in (35), with determinant given by
.

Fig. 8 shows the consequences of over-dispersed spike responses on the estimation of tuning curves and their hyperparameters. We generated a 2D map firing rate map as a mixture of Gaussian bumps (left), and simulated spike counts from the flexible over-dispersion model (with exponential nonlinearity) at a random collection of 2D locations. We then performed inference using either the Poisson model (center) or flexible over-dispersion model (right). We found that the Poisson estimate suffered from systematic under-estimation of the GP length scale, resulting in an estimate that is significantly rougher than the true map. In essence, the Poisson model attributes super-Poisson variability of the responses as reflecting structure in the firing rate map itself rather than noise, thus necessitating a shorter length scale *δ*.

### 6.4 Adaptive stimulus selection method

To adaptively select stimuli during an experiment, we search for the stimulus for which the posterior variance of the tuning curve is maximal. This approach, commonly known as uncertainty sampling, is motivated by the idea that we would like to minimize posterior uncertainty about the tuning curve at all points within the stimulus range.

To recap, the tuning curve given given the input function *g*(·) is the expected spike count given a stimulus:

However, during inference from data we have uncertainty about *g*(·), which is characterized by the (approximate) Gaussian posterior derived in the previous section (eq. 40). To compute the posterior mean and variance over the tuning curve *λ*(**x**
^{∗}) at any candidate stimulus **x**
^{∗}, we have to transform the posterior distribution over *g*(**x**
^{∗}) through the nonlinearity *f*.

Letting *z ^{∗}
* =

*g*(

**x**

^{∗}) as before, the mean and variance of the tuning curve are given by: with stimulus-specific mean and variance

*µ*

_{x}

*∗*and given in (eqs. 41, 42). In practice, our method involves computing posterior variance (eq. 47) for a grid of candidate stimuli {

**x**

^{*}} and selecting the one for which posterior variance is largest:

### 6.5 Results: adaptive stimulus selection for color tuning curves

We applied our method to the problem of estimating color tuning functions for V1 neurons recorded in awake, fixating monkeys under two paradigms. In the first paradigm, Gabor patches (Gaussian windowed sinusoidal gratings) were drifted across the V1 receptive field. The orientation, spatial frequency, and direction of drift in each Gabor patch was tailored to each neuron. The drifting Gabors modulated the long, medium, and short-wavelength sensitive cones in various degrees and ratios such that they produced a single target response from the neuron. In the second paradigm, Gaussian smoothed rectangular bars drifted across the receptive field. The length and width of the bar, as well as it direction of drift, was tailored to each cell and smoothed with a Gaussian window. Fig. 9 shows a schematic illustrating the stimulus space, the raw experimental data, and the adaptive stimulus stimulus selection protocol.

In interleaved trials, individual V1 neurons were tested with stimuli that were chosen either adaptively (using our method, Fig. 9C) or non-adaptively. In non-adaptive trials, stimulus selection was independent of responses. In adaptive trials, stimulus selection was based on the posterior variance of the firing rate map in the over-dispersed GP-Poisson model. Results showed that the adaptive method yielded faster convergence and more accurate firing map estimates than the non-adaptive method.

We used color-contrast-varying stimuli (either 2D or 3D), whose contrast levels are tuned by three values applied to L, M, and S cones. We measured responses to the stimuli by each cell from the primary visual cortex. As shown in Figure 10, the estimates of the Poisson model are much coarser than would be expected. As a result, the super-Poisson model achieved on average a four-times higher likelihood on test data, compared to the Poisson model.

In the closed-loop design, we selected the stimulus that had the highest posterior variance of firing rate map in each trial. In the open-loop design, we sampled the stimuli uniformly from the polar grid. In Figure 11, we show the estimated tuning functions using all data collected from both paradigms, as well as estimates using a quarter of the data collected from each design. The estimates obtained by closed-loop design look more similar to the estimates obtained by using all the data. Finally, we computed the average prediction error using data collected from each paradigm. The closed-loop method achieved substantially lower prediction error and faster convergence than the open-loop method.

## 7 Discussion

We have presented here a flexible model for super-Poisson spike-count responses and applied the new model to closed-loop neurophysiology experiments. Our model, which introduces extra-Poisson variability via a Gaussian noise term added to the stimulus response level and passed through a nonlinearity, provides flexibility in accounting for neural over-dispersion and permits efficient model-fitting. We find that this model better fits individual mean-variance relationships for neurons in V1. Furthermore, we find that when used as a likelihood in lieu of the Poisson likelihood, our model can significantly improve closed-loop estimation of color tuning curves in V1.

### Relationship to previous work

A wide variety of other approaches to over-dispersed spike count distributions have been proposed in the recent literature. These include mixtures of Poisson distributions (Wiener & Richmond, 2003; Shidara et al., 2005) and the Twiddle distribution, which is characterized by a polynomial mean-variance relationship var[*r*] = *α*𝔼[*r*])^{ρ} for some *α* and *ρ* (Moshitch & Nelken, 2014; Koyama, 2015; Gershon et al., 1998). Although these models offer substantial improvements over models that specify a single Fano-factor, they are still restricted in the classes of over-dispersion modeled, and in some cases are more difficult to connect to mechanistic interpretations (i.e., how such counts might be generated). In contrast to these approaches, recent work on neural partitioning and negative binomial spike counts (Onken et al., 2009; Goris et al., 2014; Pillow & Scott, 2012a) instead seeks more descriptive, interpretable models of over-dispersion via hierarchical (or doubly stochastic) modeling.

Other methods to quantify neural over-dispersion rely on describing more general count distributions, such as the Bernoulli or Conway-Maxwell-Poisson (COM-Poisson) distributions (Zhu et al., 2017; Sellers et al., 2012), rather than layering on top of the Poisson distribution (Gao et al., 2015; Stevenson, 2016). These models may be limited by requiring many additional parameters (Gao et al., 2015), or may require that the mean-variance curves be monotonically increasing (Stevenson, 2016), reducing the model’s ability to explain neurons which exhibit higher variance at lower means. While completely replacing the Poisson distribution is satisfying in that the mean-variance relationship is no longer restricted at any stage by Poisson behavior, we find that layering additional variability inside the Poisson rate is more intuitive (Goris et al., 2014). Specifically, we find that such hierarchical models can isolates variables responsible for over-dispersion and allows mechanistic theories to attempt and explain these factors.

Our model can be considered as a significant generalization of the mixture-of-Poisson models (Wiener & Richmond, 2003; Shidara et al., 2005), as our model is essentially an infinite mixture of Poissons, as well as a generalization of prior work using latent hierarchical dispersion variables (Goris et al., 2014). In terms of the power-law models of (Moshitch & Nelken, 2014; Koyama, 2015), our model also includes as a subset any power-law where the exponent is between one and two (i.e. var[*r*] = *a*(𝔼[*r*])^{ρ} for 1*≤ ρ ≤*2). Although our model is incapable of achieving *ρ >* 2 or *ρ <* 1, the achievable range of *ρ* includes experimentally observed values in the literature, e.g. *ρ* ≈ 1.3 (Shadlen & Newsome, 1998) or 1.1 *≤ ρ ≤* 1.5 for cat auditory cortex (Moshitch & Nelken, 2014). Interestingly, however, our analysis demonstrates that power-law type characterizations might still be insufficient for assessing neural overdispersion. In particular, our model exploration indicates that a full discussion of the firing statistics should also include the full count distributions (see Fig. 7). Our results demonstrated that our model more accurately captures the variation in V1 neural responses, as compared to both traditional and more recent Poisson-based models.

### Interpretation and future directions

The origins of neural response variability are still a subject of debate (Renart & Machens, 2014; Masquelier, 2013), and we admit that our model does not attempt to explain how over-dispersion arises. Our model only implies that the unknown nuisance variable is well modeled by an addition of stimulus-dependent drive and Gaussian noise, followed by a nonlinearity and Poisson spike generation. In terms of the nonlinearity used, we found that the single-parameter “power soft-rectification” function was flexible enough to account for a large range of neural behavior, despite its reliance on a single parameter. The inference cost for the flexible overdispersion model therefore remains modest, and is moreover justified by the substantial gain in model expressibility (e.g., as shown by the AIC results in Fig. 6). Other nonlinearities are certainly possible in this framework, and the general properties we describe in Section 3 guarantee that, aside from perhaps requiring numerical integration, the model will be well behaved (i.e. the variance-mean curve will remain a proper function). For example, we found that the exponential non-linearity allowed for more computationally efficient calculations for the closed-loop inference procedure. We note that our model also does not attempt to account for the *under*-dispersion sometimes observed in certain neural circuits, such as retina or auditory cortex, that exhibit higher degrees of response regularity (DeWeese & Zador, 2002; Kara et al., 2000; Gur et al., 1997; Maimon & Assad, 2009). Comparable flexible models for under-dispersed spike counts therefore poses an important open problem for future work. As a final note, the increasing number of simultaneously recorded neurons also poses a future challenge of explaining the

While we focus here on explaining super-Poisson behavior of neural firing, we note that our model does not attempt to account for the *under*-dispersion sometimes observed in certain neural circuits, such as retina or auditory cortex, that exhibit higher degrees of response regularity (DeWeese & Zador, 2002; Kara et al., 2000; Gur et al., 1997; Maimon & Assad, 2009). Comparable flexible models for under-dispersed spike counts therefore poses an important open problem for future work. As a final note, our model focuses only on explaining the spiking process for a single neuron. The increasing number of simultaneously recorded neurons thus poses the future challenge of explaining correlations in over-dispersion between neurons (e.g. Goris et al. (2014)). Such population over-dispersion models would carry through the benefits of more accurate spike-count models that we observe here for single-neuron closed-loop experiments to cases where entire populations are analyzed simultaneously.

## Acknowledgments

We are grateful to Arnulf Graf and J. Anthony Movshon for V1 spike count data used for fitting and validating the flexible over-dispersion model. ASC was supported by the NIH NRSA Training Grant in Quantitative Neuroscience (T32MH065214). MP was supported by the Gatsby Charitable Foundation. JWP was supported by grants from the McKnight Foundation, Simons Collaboration on the Global Brain (SCGB AWD1004351) the NSF CAREER Award (IIS-1150186), and an NIMH grant (MH099611).

## Appendix A: Modulated Poisson and the NB model

Here we review the connection between the modulated Poisson model introduced by Goris et al. (2014) and the negative binomial model. The modulated Poisson model was introduced generally as having a Poisson rate *λ*(**x**) modulated by a stochastic gain *G* with a distribution satisfying 𝔼[*G*] = 1 and
. The general mean-variance relationship of the marginal spike counts under this model was shown to always satisfy a quadratic relationship (i.e.,
. However, fitting the model parameters to data required additional assumptions about the distribution of *G*. In particular, Goris *et al*. used a gamma distribution, which makes the integral over *G* analytically tractable, producing a negative binomial distribution over spike counts.

To see this connection formally, we can write the model, substituting *z* = *λ*(**x**) for the stimulus-dependent firing rate:
where 1/
and
correspond to the shape and scale parameters for the gamma distribution, which ensures 𝔼[*G*] = 1 and var[*G*] =
. The spike count *r* then has a negative binomial distribution:

The derivation of the Negative Binomial PMF from a Poisson distribution with a Gamma prior can be obtained via the following straight-forward integration: which for and results in the above NB distribution.

## Appendix B: Parameter optimization using Laplace approximation

The general method we present for estimating the parameters of the nonlinearity that modulates neural spiking is outlined in Algorithm 1. For a particular nonlinearity (i.e. the soft-rectification raised to a power in Equation (13)), these steps can be written more explicitly. Here we fit data using both the exponential nonlinearity, for which the fitting algorithm is provided in Algorithm 3, and the power-soft-rectification nonlinearity, corresponding to the model fitting in Algorithm 2). Note that the estimation of and the gradient descent steps for *θ* and *z* can be accomplished analytically, however the estimation of *n*
_{0} would typically need to be calculated numerically.

## Footnotes

↵* Shared first authorship.

↵1 Note that in contrast to (Goris et al., 2014), we define

*λ*(**x**) in units of spikes-per-bin, removing the bin-size Δ from the ensuing equations.