Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STDP Mechanism: Fail to set tau_minus to a RandomDistribution #662

Closed
hasref opened this issue Dec 27, 2019 · 1 comment
Closed

STDP Mechanism: Fail to set tau_minus to a RandomDistribution #662

hasref opened this issue Dec 27, 2019 · 1 comment
Milestone

Comments

@hasref
Copy link

hasref commented Dec 27, 2019

I am using STDPMechanism with pyNN.nest in a simulation where I want to randomize tau_plus and tau_minus. Setting tau_plus to a RandomDistribution works just fine. However, setting tau_minus does not:

sim.STDPMechanism(
    timing_dependence=sim.SpikePairRule(A_plus = 0.1,  
    A_minus = 0.1,
    tau_minus = RandomDistribution('uniform', (20,40)),
    tau_plus = self.tau_plus),

results in

Traceback (most recent call last):

  File "/home/usr/src/examples/stdp_reservoir_example.py", line 53, in <module>
    lsm = LifStdp(num_exic,num_inhib, timestep=100, tau_minus = tau_minus, tau_plus = tau_plus)

  File "/home/usr/src/snn/Lsm.py", line 406, in __init__
    d_mean, d_var, timestep, tau_plus, tau_minus, max_activation)

  File "/home/usr/src/snn/Lsm.py", line 266, in __init__
    self._create_connections()

  File "/home/usr/src/snn/Lsm.py", line 425, in _create_connections
    super()._create_connections()

  File "/home/usr/src/snn/Lsm.py", line 317, in _create_connections
    receptor_type='excitatory')

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/pyNN/nest/projections.py", line 47, in __init__
    self.nest_synapse_model = self.synapse_type._get_nest_synapse_model()

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/pyNN/nest/standardmodels/synapses.py", line 72, in _get_nest_synapse_model
    synapse_defaults.pop("tau_minus")

KeyError: 'tau_minus'

Additionally, it does not seem possible to set tau_minus through the projection either:

>>> lsm_proj.set( tau_minus = RandomDistribution('uniform', (20,40) ) )

Traceback (most recent call last):

  File "<ipython-input-3-0b2e43973429>", line 1, in <module>
    lsm_proj.set( tau_minus = RandomDistribution('uniform', (20,40) ) )

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/pyNN/common/projections.py", line 185, in set
    self._set_attributes(parameter_space)

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/pyNN/nest/projections.py", line 267, in _set_attributes
    nest.SetStatus(connections, name, value[source_mask])

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/nest/ll_api.py", line 246, in stack_checker_func
    return f(*args, **kwargs)

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/nest/lib/hl_api_info.py", line 269, in SetStatus
    sr('Transpose { arrayload pop SetStatus } forall')

  File "/home/usr/miniconda3/envs/src/lib/python3.7/site-packages/nest/ll_api.py", line 132, in catching_sli_run
    raise exceptionCls(commandname, message)

NESTErrors.DictError: ('DictError in SetStatus_CD: Unused dictionary items:  tau_minus\nMaybe you tried to set common synapse properties through an individual synapse?', 'DictError', <SLILiteral: SetStatus_CD>, ': Unused dictionary items:  tau_minus\nMaybe you tried to set common synapse properties through an individual synapse?')

While setting tau_plus works fine:

>>>lsm_proj.set( tau_plus = RandomDistribution('uniform', (20,40) ) )

I am using pyNN 0.9.5 and nest 2.18.0.

@hasref hasref changed the title STDP Mechanism: setting tau_minus to a RandomDistribution STDP Mechanism: Fail to set tau_minus to a RandomDistribution Dec 27, 2019
@apdavison apdavison added this to the 0.9.6 milestone May 18, 2020
apdavison added a commit to apdavison/PyNN that referenced this issue Dec 19, 2020
@apdavison
Copy link
Member

apdavison commented Dec 21, 2020

@has-ash first of all I'm sorry it has taken to long to deal with this; things have been very hectic this past year; the pace of PyNN development should pick up soon, though, with a couple of new people coming on board.

Unfortunately, NEST does not support fully heterogeneous values for tau_minus, because tau_minus is a parameter of the postsynaptic neuron, not of the synapse model (I assume this is for performance reasons). If partly-heterogeneous connections (all synapses onto a given post-synaptic neuron have the same tau_minus, but this can vary between neurons) would be useful, let me know and I'll implement it.

A complete fix for this would require someone to write a new NEST synapse model.

In the meantime, I've improved the error messages to give a better explanation of the situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants