-
Notifications
You must be signed in to change notification settings - Fork 362
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
Numerical imprecision stdp #924
Changes from all commits
76f7f82
c0d8869
3727de3
005e957
8604e22
85fdbea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -452,7 +452,8 @@ STDPDopaConnection< targetidentifierT >::process_dopa_spikes_( | |
// process dopa spikes in (t0, t1] | ||
// propagate weight from t0 to t1 | ||
if ( ( dopa_spikes.size() > dopa_spikes_idx_ + 1 ) | ||
&& ( dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ <= t1 ) ) | ||
&& ( t1 - dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ > -1.0 | ||
* kernel().connection_manager.get_stdp_eps() ) ) | ||
{ | ||
// there is at least 1 dopa spike in (t0, t1] | ||
// propagate weight up to first dopa spike and update dopamine trace | ||
|
@@ -468,7 +469,8 @@ STDPDopaConnection< targetidentifierT >::process_dopa_spikes_( | |
// process remaining dopa spikes in (t0, t1] | ||
double cd; | ||
while ( ( dopa_spikes.size() > dopa_spikes_idx_ + 1 ) | ||
&& ( dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ <= t1 ) ) | ||
&& ( t1 - dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ > -1.0 | ||
* kernel().connection_manager.get_stdp_eps() ) ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you try to get the -1.0 on the same line as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, not possible due to coding style guidelines. |
||
{ | ||
// propagate weight up to next dopa spike and update dopamine trace | ||
// weight and dopamine trace n are at time of last dopa spike td but | ||
|
@@ -565,8 +567,9 @@ STDPDopaConnection< targetidentifierT >::send( Event& e, | |
process_dopa_spikes_( dopa_spikes, t0, start->t_ + dendritic_delay, cp ); | ||
t0 = start->t_ + dendritic_delay; | ||
minus_dt = t_last_update_ - t0; | ||
if ( start->t_ < t_spike ) // only depression if pre- and postsyn. spike | ||
// occur at the same time | ||
// facilitate only in case of post- after presyn. spike | ||
// skip facilitation if pre- and postsyn. spike occur at the same time | ||
if ( t_spike - start->t_ > kernel().connection_manager.get_stdp_eps() ) | ||
{ | ||
facilitate_( Kplus_ * std::exp( minus_dt / cp.tau_plus_ ), cp ); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,9 @@ | |
|
||
#include "archiving_node.h" | ||
|
||
// Includes from nestkernel: | ||
#include "kernel_manager.h" | ||
|
||
// Includes from sli: | ||
#include "dictutils.h" | ||
|
||
|
@@ -81,7 +84,9 @@ Archiving_Node::register_stdp_connection( double t_first_read ) | |
// For details see bug #218. MH 08-04-22 | ||
|
||
for ( std::deque< histentry >::iterator runner = history_.begin(); | ||
runner != history_.end() && runner->t_ <= t_first_read; | ||
runner != history_.end() | ||
&& ( t_first_read - runner->t_ > -1.0 | ||
* kernel().connection_manager.get_stdp_eps() ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you try to get the -1.0 on the same line as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, not possible due to coding style guidelines. |
||
++runner ) | ||
{ | ||
( runner->access_counter_ )++; | ||
|
@@ -100,7 +105,7 @@ nest::Archiving_Node::get_K_value( double t ) | |
int i = history_.size() - 1; | ||
while ( i >= 0 ) | ||
{ | ||
if ( t > history_[ i ].t_ ) | ||
if ( t - history_[ i ].t_ > kernel().connection_manager.get_stdp_eps() ) | ||
{ | ||
return ( history_[ i ].Kminus_ | ||
* std::exp( ( history_[ i ].t_ - t ) * tau_minus_inv_ ) ); | ||
|
@@ -126,7 +131,7 @@ nest::Archiving_Node::get_K_values( double t, | |
int i = history_.size() - 1; | ||
while ( i >= 0 ) | ||
{ | ||
if ( t > history_[ i ].t_ ) | ||
if ( t - history_[ i ].t_ > kernel().connection_manager.get_stdp_eps() ) | ||
{ | ||
triplet_K_value = ( history_[ i ].triplet_Kminus_ | ||
* std::exp( ( history_[ i ].t_ - t ) * tau_minus_triplet_inv_ ) ); | ||
|
@@ -159,12 +164,16 @@ nest::Archiving_Node::get_history( double t1, | |
else | ||
{ | ||
std::deque< histentry >::iterator runner = history_.begin(); | ||
while ( ( runner != history_.end() ) && ( runner->t_ <= t1 ) ) | ||
while ( ( runner != history_.end() ) | ||
&& ( t1 - runner->t_ > -1.0 | ||
* kernel().connection_manager.get_stdp_eps() ) ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you try to get the -1.0 on the same line as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, not possible due to coding style guidelines. |
||
{ | ||
++runner; | ||
} | ||
*start = runner; | ||
while ( ( runner != history_.end() ) && ( runner->t_ <= t2 ) ) | ||
while ( ( runner != history_.end() ) | ||
&& ( t2 - runner->t_ > -1.0 | ||
* kernel().connection_manager.get_stdp_eps() ) ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you try to get the -1.0 on the same line as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, not possible due to coding style guidelines. |
||
{ | ||
( runner->access_counter_ )++; | ||
++runner; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1699,6 +1699,26 @@ NestModule::DisableStructuralPlasticity_Function::execute( | |
i->EStack.pop(); | ||
} | ||
|
||
/** | ||
* Set epsilon that is used for comparing spike times in STDP. | ||
* Spike times in STDP synapses are currently represented as double | ||
* values. The epsilon defines the maximum distance between spike | ||
* times that is still considered 0. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good point. Done. |
||
* | ||
* Note: See issue #894 | ||
*/ | ||
void | ||
NestModule::SetStdpEps_dFunction::execute( SLIInterpreter* i ) const | ||
{ | ||
i->assert_stack_load( 1 ); | ||
const double stdp_eps = getValue< double >( i->OStack.top() ); | ||
|
||
kernel().connection_manager.set_stdp_eps( stdp_eps ); | ||
|
||
i->OStack.pop(); | ||
i->EStack.pop(); | ||
} | ||
|
||
void | ||
NestModule::init( SLIInterpreter* i ) | ||
{ | ||
|
@@ -1794,6 +1814,9 @@ NestModule::init( SLIInterpreter* i ) | |
"GetStructuralPlasticityStatus", &getstructuralplasticitystatus_function ); | ||
i->createcommand( "Disconnect", &disconnect_i_i_lfunction ); | ||
i->createcommand( "Disconnect_g_g_D_D", &disconnect_g_g_D_Dfunction ); | ||
|
||
i->createcommand( "SetStdpEps", &setstdpeps_dfunction ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I don't think that we want a |
||
|
||
// Add connection rules | ||
kernel().connection_manager.register_conn_builder< OneToOneBuilder >( | ||
"one_to_one" ); | ||
|
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.
Could you try to get the -1.0 on the same line as
kernel()....
? I think that would be good for legibility.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 am afraid the coding style guidelines do not permit this.