How to get stochasticity in LIF neurons?


  1. What is the right way to get stochasticity in LIF neurons? Is it already implemented in nengo or one must create a new neuron type in nengo?
  2. How is the noise (from the noise parameter in Ensemble) injected in LIF neurons?
  3. Where does noise happen in the Nengo simulator and how is it taken into account?

I want stochasticity in LIF neurons. I have read online that to get stochastic neurons, one should implement the Ornstein-Uhlenbeck (O-U) process. After my research on the Nengo forum on how to introduce stochasticity, I came across White Noise processes and there was a reference in the docstring

… [1] Gillespie, D.T. (1996) Exact numerical simulation of the Ornstein-
Uhlenbeck process and its integral. Phys. Rev. E 54, pp. 2084-91.

However, in step_whitenoise, I don’t see any O-U process implementation. It is just a simple White noise implementation.

     def step_whitenoise(_):
            x = dist.sample(n=1, d=shape_out[0], rng=rng)[0]
            return alpha * x if scale else x

So, I wondered why there is a reference to the O-U process in white noise. Is the O-U process implemented elsewhere?

I can see the stochasticity when I pass the white noise process as a noise parameter in the ensemble like this:

process = nengo.processes.WhiteNoise(dist=nengo.dists.Gaussian(0, 1), scale=True, seed=0)

ens_param = dict(n_neurons=n_in_neurons,
                 intercepts=np.ones(shape=(n_in_neurons,)) * 0.5,
ens_1 = nengo.Ensemble(noise=process,
                       label="ens with noise",

Is the right way to introduce stochasticity in LIF neurons?

At what stage of nengo implementation (run, build, sim, etc) is the noise injected in LIF neurons? Where exactly does it happen? Can you please point me to the source code?

Thank you for your time

The O-U process is implemented as FilteredNoise.

That’s the correct way to add noise to an ensemble. It’s implemented here, where the output of the noise process is set to be added to (mode="inc") the neurons’ input currents. That build call will then call the Process builder.

1 Like

@Eric Thank you for your reply.

There are many builders (ensemble, learning rule, processes, connections etc) in nengo and as per my understanding Builder class builds the final object step by step. This builder is independent of other objects. How and where does each builder class (ensemble, learning rule, processes, connections etc) interact with each other and produce the final result?

Best Regards