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

Static synapse with transmission probability #747

Merged
merged 12 commits into from Jun 23, 2017

Conversation

Projects
None yet
5 participants
@hyukz
Contributor

hyukz commented Jun 9, 2017

A new synapse model built over static_synapse introducing a transmission probability p_transmit used to calculate whether the spike reaches the target or not.
Inspired by the results described in [1] of greater transmission probability for stronger excitatory connections and previously applied in [2] and [3].

[1] Sandrine Lefort, Christian Tomm, J.-C. Floyd Sarria, Carl C.H. Petersen, The Excitatory Neuronal Network of the C2 Barrel Column in Mouse Primary Somatosensory Cortex, Neuron, Volume 61, Issue 2, 29 January 2009, Pages 301-316, DOI: 10.1016/j.neuron.2008.12.020.

[2] Jun-nosuke Teramae, Yasuhiro Tsubo & Tomoki Fukai, Optimal spike-based communication in excitable networks with strong-sparse and weak-dense links, Scientific Reports 2, Article number: 485 (2012), DOI: 10.1038/srep00485

[3] Yoshiyuki Omura, Milena M. Carvalho, Kaoru Inokuchi, Tomoki Fukai, A Lognormal Recurrent Network Model for Burst Generation during Hippocampal Sharp Waves, Journal of Neuroscience 28 October 2015, 35 (43) 14585-14601; DOI: 10.1523/JNEUROSCI.4944-14.2015

added new synapse lossy_connection.h and its unit test test_lossy_syn…
…apse.sli. new

synapse and new parameter name "p_transmit" were added to listings in other files.
@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 9, 2017

Contributor

@hyukz Thank you for your contribution. We will try to review it without too much delay. Before we can integrate your code into NEST, we require that you transfer copyright to the NEST Initiative. Please download our Contributor License Agreement from http://nest.github.io/nest-simulator/, and returned it to me signed (by email to my @nmbu.no address).

Contributor

heplesser commented Jun 9, 2017

@hyukz Thank you for your contribution. We will try to review it without too much delay. Before we can integrate your code into NEST, we require that you transfer copyright to the NEST Initiative. Please download our Contributor License Agreement from http://nest.github.io/nest-simulator/, and returned it to me signed (by email to my @nmbu.no address).

Merge pull request #1 from mschmidt87/lossy-connection
Improve documentation of synapse class and test
@mschmidt87

This comment has been minimized.

Show comment
Hide comment
@mschmidt87

mschmidt87 Jun 9, 2017

Actually, I was involved in creating this pull-request, so I guess it would make more sense if someone else reviewed the code. The original implementation was done by @suku248 back in the old days of the 10kcollaps branch. We basically moved this implementation into the current framework and wrote the test. I therefore added her now as an author to the synapse file. I hope that's fine.

As alternative reviewer, I would thus suggest either @suku248 as a reviewer or @jakobj .

mschmidt87 commented Jun 9, 2017

Actually, I was involved in creating this pull-request, so I guess it would make more sense if someone else reviewed the code. The original implementation was done by @suku248 back in the old days of the 10kcollaps branch. We basically moved this implementation into the current framework and wrote the test. I therefore added her now as an author to the synapse file. I hope that's fine.

As alternative reviewer, I would thus suggest either @suku248 as a reviewer or @jakobj .

@jakobj

jakobj approved these changes Jun 9, 2017

Very nice work! I've added a few comments that should be fixed before merging, but since these are just minor points, I'll already approve now.

Show outdated Hide outdated models/lossy_connection.h Outdated
Show outdated Hide outdated models/lossy_connection.h Outdated
Show outdated Hide outdated testsuite/unittests/test_lossy_synapse.sli Outdated
Show outdated Hide outdated testsuite/unittests/test_lossy_synapse.sli Outdated
@mschmidt87

This comment has been minimized.

Show comment
Hide comment
@mschmidt87

mschmidt87 Jun 9, 2017

Thanks for the quick review.

One thing that we discussed, is the name of the synapse. We were not 100 % happy with lossy_synapse, but couldn't come up with a better name. stochastic_synapse seems ambiguous, because this could also mean a stochastic variation of e.g. the weight.

mschmidt87 commented Jun 9, 2017

Thanks for the quick review.

One thing that we discussed, is the name of the synapse. We were not 100 % happy with lossy_synapse, but couldn't come up with a better name. stochastic_synapse seems ambiguous, because this could also mean a stochastic variation of e.g. the weight.

@hyukz

This comment has been minimized.

Show comment
Hide comment
@hyukz

hyukz Jun 9, 2017

Contributor

New commit includes the suggestions pointed by @jakobj and tentatively solves the problems with Travis build (wrong model name in documentation).

As @mschmidt87 mentioned, we are not greatly fond of the current name for this synapse model, so suggestions are highly appreciated. My second option is (static_)stochtrans_synapse, with stochtrans meaning Stochastic Transmission.

Contributor

hyukz commented Jun 9, 2017

New commit includes the suggestions pointed by @jakobj and tentatively solves the problems with Travis build (wrong model name in documentation).

As @mschmidt87 mentioned, we are not greatly fond of the current name for this synapse model, so suggestions are highly appreciated. My second option is (static_)stochtrans_synapse, with stochtrans meaning Stochastic Transmission.

@heplesser heplesser removed the request for review from mschmidt87 Jun 9, 2017

@heplesser

I added some comments on the test and will review more later.

Show outdated Hide outdated testsuite/unittests/test_lossy_synapse.sli Outdated
Show outdated Hide outdated testsuite/unittests/test_lossy_synapse.sli Outdated
Show outdated Hide outdated testsuite/unittests/test_lossy_synapse.sli Outdated
@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 9, 2017

Contributor

How about bernoulli_synapse, since the synapse performs a Bernoulli trial on each spike?

Contributor

heplesser commented Jun 9, 2017

How about bernoulli_synapse, since the synapse performs a Bernoulli trial on each spike?

@mschmidt87

This comment has been minimized.

Show comment
Hide comment
@mschmidt87

mschmidt87 Jun 12, 2017

Currently, the regression test "ticket-478.sli" fails. It tests whether NEST fails when the user tries to connect devices using plastic synapses. It distinguishes synapses into plastic and static synapses by checking the parameters of their status dictionaries. If there is any additional parameter beyond the parameters of static_synapse, it classifies the synapse model as plastic.
Consequently, lossy_synapse is classified as plastic, but with the current implementation, we can connect devices using this synapse --> test fails.

The question: Is there a reasonable use case, where one wants to connect a device to a neuron using a lossy_synapse?
For recording devices, I would say that there is no use case. For stimulating devices, however, I could imagine that one would like to simulate a network with a common stimulus but let neurons receive stochastic samples of the stimulus.
What do you think, should we enable such a use case?

Then the test has to reformulated. However, as far as I can see, the test is currently broken, anyway, because it falsely classifies static synapses if and only if they have exactly the same parameters as static_synapse AND static_synapse_lbl. This is not the case for any synapse model, so that the tests does not classify any synapse as being static, which doesn't make sense.

mschmidt87 commented Jun 12, 2017

Currently, the regression test "ticket-478.sli" fails. It tests whether NEST fails when the user tries to connect devices using plastic synapses. It distinguishes synapses into plastic and static synapses by checking the parameters of their status dictionaries. If there is any additional parameter beyond the parameters of static_synapse, it classifies the synapse model as plastic.
Consequently, lossy_synapse is classified as plastic, but with the current implementation, we can connect devices using this synapse --> test fails.

The question: Is there a reasonable use case, where one wants to connect a device to a neuron using a lossy_synapse?
For recording devices, I would say that there is no use case. For stimulating devices, however, I could imagine that one would like to simulate a network with a common stimulus but let neurons receive stochastic samples of the stimulus.
What do you think, should we enable such a use case?

Then the test has to reformulated. However, as far as I can see, the test is currently broken, anyway, because it falsely classifies static synapses if and only if they have exactly the same parameters as static_synapse AND static_synapse_lbl. This is not the case for any synapse model, so that the tests does not classify any synapse as being static, which doesn't make sense.

@hyukz

This comment has been minimized.

Show comment
Hide comment
@hyukz

hyukz Jun 12, 2017

Contributor

The newest commit changes the synapse name to Bernoulli synapse and fixes all previously mentioned problems with the unit test.

About ticket-478.sli, I am not familiar with the test per se but I also believe that bernoulli_synapse could be used to connect a stimulating device to a neuron in some circunstances. Actually, in my naïve point of view, there may be other synaptic mechanisms which are plausible to connect a spiking stimulus device to a neuron, though I don't know if there are implementation problems that come with that.

Contributor

hyukz commented Jun 12, 2017

The newest commit changes the synapse name to Bernoulli synapse and fixes all previously mentioned problems with the unit test.

About ticket-478.sli, I am not familiar with the test per se but I also believe that bernoulli_synapse could be used to connect a stimulating device to a neuron in some circunstances. Actually, in my naïve point of view, there may be other synaptic mechanisms which are plausible to connect a spiking stimulus device to a neuron, though I don't know if there are implementation problems that come with that.

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 12, 2017

Contributor

The NEST Open Developer VC on 12 June has favoured bernoulli_synapse as name of this model.

Contributor

heplesser commented Jun 12, 2017

The NEST Open Developer VC on 12 June has favoured bernoulli_synapse as name of this model.

@heplesser

@hyukz This looks mostly fine, I commented on some details.

handles_test_event( SpikeEvent&, rport )
{
return invalid_port_;
}

This comment has been minimized.

@heplesser

heplesser Jun 12, 2017

Contributor

This synapse should only transmit normal spikes. Therefore, only handles_test_event( SpikeEvent&, rport ) must be implemented, all other overloaded variants below should be deleted. This will solve the problems with the ticket-478 test.

@heplesser

heplesser Jun 12, 2017

Contributor

This synapse should only transmit normal spikes. Therefore, only handles_test_event( SpikeEvent&, rport ) must be implemented, all other overloaded variants below should be deleted. This will solve the problems with the ticket-478 test.

Show outdated Hide outdated models/bernoulli_connection.h Outdated
Show outdated Hide outdated models/bernoulli_connection.h Outdated
Show outdated Hide outdated models/bernoulli_connection.h Outdated
Show outdated Hide outdated models/bernoulli_connection.h Outdated
Show outdated Hide outdated models/bernoulli_connection.h Outdated
Show outdated Hide outdated nestkernel/nest_names.cpp Outdated
Show outdated Hide outdated testsuite/unittests/test_bernoulli_synapse.sli Outdated
Show outdated Hide outdated models/bernoulli_connection.h Outdated
@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 12, 2017

Contributor

@hyukz @mschmidt87 The reason that the ticket-478 test fails, is that bernoulli_synapse currently allows all kinds of events to pass, while it should only transmit SpikeEvents. I added a comment in the code indicating what to change. We cannot use bernoulli_synapse to transmit spikes from devices using DSSpikeEvents, because these devices use a callback mechanism that will not work properly if spikes may be dropped in transit.

Contributor

heplesser commented Jun 12, 2017

@hyukz @mschmidt87 The reason that the ticket-478 test fails, is that bernoulli_synapse currently allows all kinds of events to pass, while it should only transmit SpikeEvents. I added a comment in the code indicating what to change. We cannot use bernoulli_synapse to transmit spikes from devices using DSSpikeEvents, because these devices use a callback mechanism that will not work properly if spikes may be dropped in transit.

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 13, 2017

Contributor

@hyukz Travis reveals two problems with you code:

  1. The bernoulli_synapse test now fails, because you cannot connect spike_generator to neurons using bernoulli_synapse any more. You need to connect the generator to a parrot_neuron using static_synapse and then connect that parrot to another parrot with bernoulli_synapse.
  2. There are some C++ code-formatting problems. Please run, from within the NEST top-level source directory extras/check_code_style.sh and fix the problems reported (most likely clang-format-3.6 -i <filename> can fix issues for you.
Contributor

heplesser commented Jun 13, 2017

@hyukz Travis reveals two problems with you code:

  1. The bernoulli_synapse test now fails, because you cannot connect spike_generator to neurons using bernoulli_synapse any more. You need to connect the generator to a parrot_neuron using static_synapse and then connect that parrot to another parrot with bernoulli_synapse.
  2. There are some C++ code-formatting problems. Please run, from within the NEST top-level source directory extras/check_code_style.sh and fix the problems reported (most likely clang-format-3.6 -i <filename> can fix issues for you.
@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 20, 2017

Contributor

@hyukz Thank you for fixing the test. The only remaining issue now is the format of the code. Please see the instructions in the NEST Developer Space on how to install the necessary tools and run them. The crucial one to make the CI test system on Travis happy is clang-format-3.6.

Contributor

heplesser commented Jun 20, 2017

@hyukz Thank you for fixing the test. The only remaining issue now is the format of the code. Please see the instructions in the NEST Developer Space on how to install the necessary tools and run them. The crucial one to make the CI test system on Travis happy is clang-format-3.6.

@hyukz

This comment has been minimized.

Show comment
Hide comment
@hyukz

hyukz Jun 20, 2017

Contributor

I am aware of that issue but I wasn't able to get clang-format-3.6 to run on my system to this point. I use Arch-Linux and even the source code from LLVM 3.6 is giving me cmake issues. As I get it to work I shall update the code.

Contributor

hyukz commented Jun 20, 2017

I am aware of that issue but I wasn't able to get clang-format-3.6 to run on my system to this point. I use Arch-Linux and even the source code from LLVM 3.6 is giving me cmake issues. As I get it to work I shall update the code.

@mschmidt87

This comment has been minimized.

Show comment
Hide comment
@mschmidt87

mschmidt87 Jun 22, 2017

Do I understand the output of the static code analysis correctly that clang only complains about nest_names.h and modelsmodule.cpp and in these files, it complains only about lines that are not changed in this PR. Why doesn't this fail in all other pull-requests as well? Is it because clang only checks files that are touched by a pull-request?
Should we fix these issues then in this pull-request although they actually seem unrelated to the bernoulli_synapse?

mschmidt87 commented Jun 22, 2017

Do I understand the output of the static code analysis correctly that clang only complains about nest_names.h and modelsmodule.cpp and in these files, it complains only about lines that are not changed in this PR. Why doesn't this fail in all other pull-requests as well? Is it because clang only checks files that are touched by a pull-request?
Should we fix these issues then in this pull-request although they actually seem unrelated to the bernoulli_synapse?

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 22, 2017

Contributor

@mschmidt87 I am not entirely sure why the formatting problems in nest_names.h have not been flagged earlier, given that we have worked quite a bit in that file previously. But please fix them, even though they are on lines that you did not touch.

I am surprised that modelsmodule.cpp is flagged as failing clang format. If I look at the log for Travis #1944.1, line 4099 seems to indicate that clang-format found a problem with modelsmodule.cpp, but l2045f shows that the file passed clang-format without a diff. Or maybe I am reading the report wrong, and the fact that modelsmodule.cpp appears on line 4099 does not mean there was a problem? @gtrensch, could you comment?

Contributor

heplesser commented Jun 22, 2017

@mschmidt87 I am not entirely sure why the formatting problems in nest_names.h have not been flagged earlier, given that we have worked quite a bit in that file previously. But please fix them, even though they are on lines that you did not touch.

I am surprised that modelsmodule.cpp is flagged as failing clang format. If I look at the log for Travis #1944.1, line 4099 seems to indicate that clang-format found a problem with modelsmodule.cpp, but l2045f shows that the file passed clang-format without a diff. Or maybe I am reading the report wrong, and the fact that modelsmodule.cpp appears on line 4099 does not mean there was a problem? @gtrensch, could you comment?

@gtrensch

This comment has been minimized.

Show comment
Hide comment
@gtrensch

gtrensch Jun 22, 2017

Contributor

@heplesser @mschmidt87 I went through the commits and it seems that the formatting issue in nest_names.h was introduced with commit a929906. I did not check the old build logs (not sure if they are still available on Travis). So I have no idea why this was not detected before.

modulesmodule.cpp is flagged correctly. It passed the "clang diff" but failed the cppcheck. Currently we ignore those message (line 4162) but do the reporting (line 4099).

Contributor

gtrensch commented Jun 22, 2017

@heplesser @mschmidt87 I went through the commits and it seems that the formatting issue in nest_names.h was introduced with commit a929906. I did not check the old build logs (not sure if they are still available on Travis). So I have no idea why this was not detected before.

modulesmodule.cpp is flagged correctly. It passed the "clang diff" but failed the cppcheck. Currently we ignore those message (line 4162) but do the reporting (line 4099).

Maximilian Schmidt and others added some commits Jun 23, 2017

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 23, 2017

Contributor

@hyukz Thank you for contributing this model!

Contributor

heplesser commented Jun 23, 2017

@hyukz Thank you for contributing this model!

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Jun 23, 2017

Contributor

Release notes: New bernoulli_synapse model: a static synapse propagating spikes with probability p.

Contributor

heplesser commented Jun 23, 2017

Release notes: New bernoulli_synapse model: a static synapse propagating spikes with probability p.

@heplesser heplesser merged commit 2a0f238 into nest:master Jun 23, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment