-
Notifications
You must be signed in to change notification settings - Fork 381
Add multi-state neuron models #3069
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: ClaudiaMer <claudia.lioba.merger@rwth-aachen.de>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Update tags, title and indexing sir neurons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @ClaudiaMer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I am basically fine with everything, just some small comments.
throw BadProperty( "All time constants must be strictly positive." ); | ||
} | ||
|
||
updateValueParam< double >( d, names::beta_sir, beta_sir_, node ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be 0 < beta < 1 or 0 <= beta <= 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle one could allow beta=0 or beta=1.
beta=0 however would make the dynamics trivial (no infection can take place), and lead to a non-sensical model.
beta=1 could be allowed, it makes the dynamics deterministic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think allowing beta=0 would make sense, if only for testing purposes. As it has a consistent interpretation, we should not limit the freedom of the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I was myself confused. Currently, we only raise an error if beta <0 or beta >1 (see line 193ff of sir_neuron.cpp) meaning that both beta=0 and beta=1 are currently allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ClaudiaMer and @jasperalbers! Sorry for coming late to the party and raising a number of questions, mostly inline. But I also have an higher-level question: Is it strictly necessary to introduce three new neuron models? Wouldn't it be possible to create one model with a parameter that allows choosing between SIS, SIR and SIRS dynamics? This would help to keep the model zoo and the amount of code to maintain smaller.
// initialize y_new | ||
size_t new_y; | ||
|
||
if ( S_.y_ == 0 ) // neuron is susceptible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For robust and readable code, it would be useful to not use magic numbers 0, 1, 2, explicitly, but rather define an
enum class InfectionState {
SUSCEPTIBLE = 0,
INFECTED,
RECOVERED
};
and to use those names here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it not more convenient to track a single integer than three separate binary variables?
@@ -183,8 +183,10 @@ enum SignalType | |||
NONE = 0, | |||
SPIKE = 1, | |||
BINARY = 2, | |||
ALL = SPIKE | BINARY | |||
SIR = 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need these there new types here or couldn't one use BINARY
to distinguish from SPIKE
? After a non-exhaustive search, I haven't been able to find any place where these new types are actually used in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could lead to confusion as the sir_neuron and sirs_neuron can take more than two states.
@@ -110,6 +110,9 @@ extern const Name beta_1; | |||
extern const Name beta_2; | |||
|
|||
extern const Name beta_Ca; | |||
extern const Name beta_sir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any need to introduce new names here, just use beta
(and eta
and mu
). From the fact that you set the beta
parameter of a SIR neuron it is sufficiently clear that this is the beta of a SIR neuron.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tried to do so in the beginning, but this threw some errors when we attempted to compile the code (unfortunately I don't remember which ones), thus we solved it this way.
struct Parameters_ | ||
{ | ||
//! mean inter-update interval in ms (acts like a membrane time constant). | ||
double tau_m_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does tau_m_
really make sense as parameter name, given that there is no membrane? Why not just tau
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tried to avoid introducing new parameters.
models/sir_neuron.h
Outdated
|
||
//! Read out the sir_neuron state of the neuron | ||
double | ||
get_output_state__() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that the __
is inherited from the existing binary neurons, but it is not good style. Private members should be marked with a single _
at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the names in update get_output_state__ to get_output_state_
Co-authored-by: clinssen <c.linssen@fz-juelich.de>
Co-authored-by: clinssen <c.linssen@fz-juelich.de>
Co-authored-by: clinssen <c.linssen@fz-juelich.de>
Co-authored-by: Hans Ekkehard Plesser <hans.ekkehard.plesser@nmbu.no>
Co-authored-by: Hans Ekkehard Plesser <hans.ekkehard.plesser@nmbu.no>
Co-authored-by: Hans Ekkehard Plesser <hans.ekkehard.plesser@nmbu.no>
We found it more convenient to introduce these three neurons as it makes the communication between neurons easier: Neurons need to communicate their change in state to other neurons, in particular, when they are infected and when then exit the infected state, this is communicated via spikes of multiplicity one and two. If there are multiple transitions (e.g. from the I to the S OR from the I to the R state), this could complicate the update rule in the neurons, which is why we distinguish SIS and SIRS neurons. Second, SIR neurons that are in the R state can be considered as "silent" as they are essentially frozen for the remainder of the dynamics, while SIRS or SIS neurons are not, as they will always allow for dynamic updates. |
This PR proposes to add multi-state neuron models used for studying infection dynamics as described in [1]. Building on the implementation of the binary neuron, these models can be in either of three states: S, I or R.
In particular, three new neuron models are added:
Their implementation closely follows the example set by the binary neuron.
If these models are deemed interesting enough to be added to the NEST simulator, we (@jasperalbers and @ClaudiaMer) would also add the corresponding documentation and tests. Here, we would be grateful for a pointer to a minimal example of what is required for both documentation and tests if that exists.
[1] https://arxiv.org/abs/2312.14851