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

Erfc neuron model #492

Merged
merged 19 commits into from Mar 23, 2018
Merged

Erfc neuron model #492

merged 19 commits into from Mar 23, 2018

Conversation

@tobikausk
Copy link
Contributor

@tobikausk tobikausk commented Sep 23, 2016

Add the neuron model "erfc-neuron" including the necessary tests. "erfc-neuron" is derived from the binary-neuron template and has got a complentary error function as activation function.
I propose @mhelias and @heplesser as reviewers.

@tobikausk tobikausk changed the title Erfc neuron model [WIP]Erfc neuron model Sep 23, 2016
@tobikausk tobikausk force-pushed the tobikausk:erfc_neuron_model branch from ff363c9 to 1be8965 Sep 27, 2016
@tobikausk tobikausk changed the title [WIP]Erfc neuron model Erfc neuron model Sep 27, 2016
@heplesser
Copy link
Contributor

@heplesser heplesser commented Sep 29, 2016

@tobikausk Please fix the C++ and Python formatting errors.

@jakobj
Copy link
Contributor

@jakobj jakobj commented Oct 3, 2016

seems like there are still formatting errors:

PEP8 analysis: (only first occurrence)
   ---------------------------------------
   | pynest/nest/tests/test_erfc_neuron.py:
   |   pynest/nest/tests/test_erfc_neuron.py:107:21: E128 continuation line under-indented for visual indent
   |   pynest/nest/tests/test_erfc_neuron.py:108:21: E122 continuation line missing indentation or outdented

it's possible that you have to fix them by hand if auto-pep8 does not catch them.

@terhorstd terhorstd requested review from heplesser and DimitriPlotnikov Jan 23, 2017
@DimitriPlotnikov
Copy link

@DimitriPlotnikov DimitriPlotnikov commented Jun 19, 2017

Hello,

could you, please, resolve conflicts?

@tobikausk
Copy link
Contributor Author

@tobikausk tobikausk commented Jun 23, 2017

We fixed all conflicts. Please have another look on what we did.

Copy link
Contributor

@heplesser heplesser left a comment

@tobikausk This looks pretty fine, just a number of details, mainly in comments/documentation.

@@ -418,6 +418,7 @@ extern const Name sdev; //!< Used in pulsepacket_generator
extern const Name send_buffer_size; //!< mpi-related
extern const Name senders; //!< Recorder parameter
extern const Name shift_now_spikes; //!< Used by spike_generator
extern const Name sigma; //!< Inverse steepness of erfc_neuron

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

The indentation is wrong here. Please fix it to make Travis (clang-format) happy!

self.build_and_connect_nodes(sigma, theta)
nest.Simulate(self.T)
mean_activity = np.round(
get_mean_activity(self.detector, self.T), 5)

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Why do you round here? Since you use AssertAlmostEqual below, that should not be necessary.

mean_activity = np.round(
get_mean_activity(self.detector, self.T), 5)
mean_activity_theory = np.round(
activation_function_theory(sigma, theta), 5)

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

See above.


// Includes from models:
#include "binary_neuron.h"
#include "binary_neuron_impl.h"

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Header files should not include *_impl.h files. If you need methods defined in and *_impl.h file, you need to move that code to erfc_neuron.cpp.

Description:
The erfc_neuron is an implementation of a binary neuron that
is irregularly updated as Poisson time points. At each update

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

as -> at

The gain function g used here is
g(h) = 0.5 * erfc (( h - theta_ ) / ( sqrt( 2. ) * sigma)).
This corresponds to a McCulloch-Pitts neuron receiving additional
Gaussian noise with mean 0 and standard deviation sigma

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Fullstop after sigma.

This corresponds to a McCulloch-Pitts neuron receiving additional
Gaussian noise with mean 0 and standard deviation sigma
The time constant tau_m is defined as the mean
inter-update-interval that is drawn from an exponential

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Is the mean interval drawn from the distribution? Aren't the intervals drawn from a distribution with this mean?

This comment has been minimized.

@tobikausk

tobikausk Aug 9, 2017
Author Contributor

Right, that was unclear.

activity. Bulletin of Mathematical Biophysics, 5:115-133.
[3] Abigail Morrison, Markus Diesmann. Maintaining Causality in Discrete Time
Neuronal
Simulations.

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Bad line breaks.

neural networks (1994).
PRE 50(4) p. 3171
[2] W. McCulloch und W. Pitts (1943). A logical calculus of the ideas
immanent in nervous

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Bad line break.

References:
[1] Iris Ginzburg, Haim Sompolinsky. Theory of correlations in stochastic
neural networks (1994).

This comment has been minimized.

@heplesser

heplesser Jun 24, 2017
Contributor

Bad line break.

@heplesser
Copy link
Contributor

@heplesser heplesser commented Aug 9, 2017

@tobikausk There are still a number of clang-format errors and the problem with the _impl.h file being included in a header file. If the latter should be necessary, please explain why.

@tobikausk
Copy link
Contributor Author

@tobikausk tobikausk commented Aug 21, 2017

@heplesser @jakobj
Thanks a lot for the very detailed commentary!
Concerning the question of the _impl.h-files, however, Jakob and I concluded that they have to be included in the erfc_neuron.h-file as it includes function definitions of the binary neuron template, which the linker otherwise misses. Therefore, we would keep this line, analogous to the case of the Ginzburg and the McCulloch-Pitts neuron.

@heplesser
Copy link
Contributor

@heplesser heplesser commented Aug 23, 2017

@tobikausk "Umgekehrt wird ein Schuh daraus", as the German proverb says: Since binary_neuron_impl.h is always included together with binary_neuron.h, because the impl file provides essential definitions of templated methods, there should be no binary_neuron_impl.h file: all the code in that file should be included in binary_neuron.h. In this way we avoid the rather confusing impl file.

Could you also merge the most recent changes from master and resolve the conflicts mentioned above?

@jakobj
Copy link
Contributor

@jakobj jakobj commented Aug 23, 2017

@heplesser: we have reached exactly the same conclusion (that there should be no _impl.h file), however changing this would go well beyond the current PR, hence a reasonable strategy is to provide the new model in the same style as the old models and create a separate PR addressing the issue of the _impl.h.
The (questionable) reasoning behind the structure of separate .h and _impl.h files seems to be in this case the separation of inline functions and regular functions, tracing back before the move to git:

$git blame models/binary_neuron_impl.h | head -n1
^c229212d (Tiziano Zito    2015-05-11 17:11:02 +0200   1) /*

I agree that this should be fixed soon.

@heplesser
Copy link
Contributor

@heplesser heplesser commented Aug 24, 2017

@jakobj @tobikausk I agree with you that removing the impl file is a separate matter and should not bloat this PR. At the same time, I think it would be good to fix the impl-issue first, instead of adding new code with the impl.

Eliminating the impl file is just a matter of copying the code in the impl file to the header file and removing existing #include "binary_neuron_impl.h files, plus updating models/CMakeLists.txt. Could you create a PR for that?

I would preferably merge that first, then update this PR correspondingly, so we avoid introducing new code which we know needs changing.

@heplesser
Copy link
Contributor

@heplesser heplesser commented Aug 24, 2017

#813 is merged to master, so updating this PR with all the newest changes from Master should get this PR ready for merging, too.

@heplesser heplesser added ZP: PR Created and removed P: Blocked labels Aug 24, 2017
@tobikausk
Copy link
Contributor Author

@tobikausk tobikausk commented Sep 20, 2017

@jakobj @heplesser @DimitriPlotnikov
Thank you very much for your help and for pushing me forward... I hope that the result is fine now.

@heplesser
Copy link
Contributor

@heplesser heplesser commented Oct 30, 2017

@tobikausk Could you fix the code formatting problems that make Travis fail?

@tobikausk
Copy link
Contributor Author

@tobikausk tobikausk commented Dec 20, 2017

@heplesser Fixed formatting issues, together with @jakobj .

@heplesser heplesser requested review from hakonsbm and removed request for DimitriPlotnikov Dec 21, 2017
Copy link
Contributor

@hakonsbm hakonsbm left a comment

This looks pretty good to me, just a couple typos that should be fixed.

The decoding scheme relies on the feature that spikes with multiplicity
larger 1 are delivered consecutively, also in a parallel setting.
The creation of double connections between binary neurons will
destroy the deconding scheme, as this effectively duplicates

This comment has been minimized.

@hakonsbm

hakonsbm Dec 22, 2017
Contributor

decoding, not "deconding"

}

void get( DictionaryDatum& ) const; //!< Store current values in dictionary
void set( const DictionaryDatum& ); //!< Set values from dicitonary

This comment has been minimized.

@hakonsbm

hakonsbm Dec 22, 2017
Contributor

dictionary, not "dicitonary"

@jougs
Copy link
Contributor

@jougs jougs commented Jan 12, 2018

@tobikausk: could you please fix the typos pointed out by @hakonsbm, so we can merge this? Thanks!

tobikausk and others added 5 commits Mar 8, 2018
@jougs
Copy link
Contributor

@jougs jougs commented Mar 9, 2018

I really wonder if we shouldn't just reformat the whole nest_names.h file in the format

/** Description for variable */
extern const Name variable;

Using the current block format it seems to be impossible to arrive at a stable format of that file that

  1. clang-format is not reformatting again and again on each call and
  2. is still below (any reasonable) line-length limit

IMO this would best be done in another PR and merged to this one.

@heplesser
Copy link
Contributor

@heplesser heplesser commented Mar 10, 2018

@jougs I very much like your suggestion! Could you implement it quickly? I guess it could be scripted ...

@jougs
Copy link
Contributor

@jougs jougs commented Mar 12, 2018

@heplesser, please see #909 for a PR that fixes the problem with Names and their comments. As most of the comments were actually wrong or outdated, I decided to remove them altogether instead of reformatting. I think that this is better, as many names are used in different places and their meaning should thus rather be defined and documented in the model.

@heplesser heplesser added this to the NEST 2.16 milestone Mar 19, 2018
# Conflicts:
#	nestkernel/nest_names.h
@jougs
Copy link
Contributor

@jougs jougs commented Mar 21, 2018

@tobikausk: can you please merge master? That should solve the failing checks and we could merge this.

Fix merge and formatting issues for erfc neuron
@heplesser heplesser merged commit 6eac560 into nest:master Mar 23, 2018
1 check passed
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.