Setting minimum and maximum firing rate of a LIF neuron


I am following the MNIST tutorial and I would like to set the minimum and maximum firing frequency of the LIF neurons.

The max_rates of a neuron is set as:
net.config[nengo.Ensemble].max_rates = nengo.dists.Choice([100])

Is there any way to set the minimum as well? What I mean to ask is that I want the neuron to have a firing frequency between an interval of let suppose 100 Hz to 200Hz.

Thank you for your reply in advance.

Hi @Choozi,

The neuron firing rates are chosen from the distribution provided to .max_rates. The nengo.dists.Choice([100]) distribution specifies that all sample points come from the array [100]. This is why all of the neurons have the same maximum firing rate of 100Hz. To set a range of values, you can provide a Uniform distribution instead, like so: nengo.dists.Uniform(100, 200). With this distribution, the neuron maximum firing rates will be chosen from a Uniform distribution between 100 and 200Hz.

Note that you can provide any distribution from nengo.dists. As an example, you can provide a Gaussian distribution, or even use the Choice distribution with multiple sample points between 100 and 200.

1 Like

Thank you very much for your help. :slight_smile:
I have been stuck with it for a while.

Note that whenever you’re learning as part of your network (as with the MNIST example), the max_rates only provide a starting place for the network. As the network learns, it’s possible that the max rates will evolve to be outside that range.

One way we account for this is by using regularization during training to keep the firing rates within desired ranged. For an example, look at the percentile_l2_loss_range in this example and how it’s used to regularize the firing rates. Note that there is some Loihi-specific code in there, but hopefully it’s straightforward to ignore and/or strip out.

@Eric thank you for your response.
I am working on the regularization method as you suggested for my MNIST example.
So this means if I have to keep the spiking threshold of the LIF neuron as explained in this thread “Spiking threshold as a parameter” in some range then I will have to do it with the same regularization method? or is there any easy way to do so?

The link you referred to is not functional.

@Choozi, the page has been moved here.