23#ifndef EPROP_ARCHIVING_NODE_RECURRENT_H
24#define EPROP_ARCHIVING_NODE_RECURRENT_H
41template <
bool hist_shift_required >
110 const double width );
129 const double width );
149 const double width );
199 const double f_target,
200 const double kappa_reg,
201 const double c_reg );
271template <
bool hist_shift_required >
278 if constexpr ( not hist_shift_required )
284template <
bool hist_shift_required >
291 if constexpr ( not hist_shift_required )
293 double eprop_isi_trace_cutoff_tmp = eprop_isi_trace_cutoff_;
297 if ( eprop_isi_trace_cutoff_tmp < 0.0 )
299 throw BadProperty(
"eprop_isi_trace_cutoff ≥ 0 required." );
302 eprop_isi_trace_cutoff_ = eprop_isi_trace_cutoff_tmp;
306template <
bool hist_shift_required >
313template <
bool hist_shift_required >
320template <
bool hist_shift_required >
324 if constexpr ( hist_shift_required )
330 return -delay_rec_out_;
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
Class implementing an intermediate archiving node model for recurrent node models supporting e-prop p...
Definition eprop_archiving_node_recurrent.h:43
void reset_spike_count()
Resets the spike count for the firing rate regularization.
Definition eprop_archiving_node_recurrent.h:315
double(EpropArchivingNodeRecurrent::* surrogate_gradient_function)(double, double, double, double, double)
Defines the pointer-to-member function type for the surrogate gradient function.
Definition eprop_archiving_node_recurrent.h:64
void count_spike()
Counts an emitted spike for the firing rate regularization.
Definition eprop_archiving_node_recurrent.h:308
void write_firing_rate_reg_to_history(const long t_current_update, const double f_target, const double c_reg)
Calculates the firing rate regularization for the current update and writes it to a new entry in the ...
Definition eprop_archiving_node_recurrent_impl.h:203
void write_learning_signal_to_history(const long time_step, const double learning_signal)
Writes the learning signal to the eprop history entry at the specifed time step.
Definition eprop_archiving_node_recurrent_impl.h:177
void append_new_eprop_history_entry(const long time_step)
Creates an entry for the specified time step at the end of the eprop history.
Definition eprop_archiving_node_recurrent_impl.h:151
double f_av_
Average firing rate.
Definition eprop_archiving_node_recurrent.h:246
EpropArchivingNodeRecurrent()
Constructs a new EpropArchivingNodeRecurrent object.
Definition eprop_archiving_node_recurrent_impl.h:45
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition eprop_archiving_node_recurrent.h:286
size_t n_spikes_
Count of the emitted spikes for the firing rate regularization.
Definition eprop_archiving_node_recurrent.h:257
surrogate_gradient_function find_surrogate_gradient(const std::string &surrogate_gradient_function_name)
Validates and finds surrogate gradient function based on the specified name.
Definition eprop_archiving_node_recurrent_impl.h:64
double compute_exponential_surrogate_gradient(const double r, const double v_m, const double v_th, const double height, const double width)
Computes an exponential function as the surrogate gradient.
Definition eprop_archiving_node_recurrent_impl.h:103
double firing_rate_reg_
Firing rate regularization.
Definition eprop_archiving_node_recurrent.h:243
static std::map< std::string, surrogate_gradient_function > surrogate_gradient_funcs_
Maps provided names of surrogate gradients to corresponding pointers to member functions.
Definition eprop_archiving_node_recurrent.h:268
double compute_piecewise_linear_surrogate_gradient(const double r, const double v_m, const double v_th, const double height, const double width)
Computes a piecewise-linear function as the surrogate gradient.
Definition eprop_archiving_node_recurrent_impl.h:87
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition eprop_archiving_node_recurrent.h:273
long model_dependent_history_shift_() const override
Returns the correct shift for history depending on whether it is a normal or a bsshslm_2020 model.
Definition eprop_archiving_node_recurrent.h:322
std::vector< HistEntryEpropFiringRateReg > firing_rate_reg_history_
History of the firing rate regularization.
Definition eprop_archiving_node_recurrent.h:260
surrogate_gradient_function compute_surrogate_gradient_
Pointer to member function selected for computing the surrogate gradient.
Definition eprop_archiving_node_recurrent.h:252
double compute_arctan_derivative_surrogate_gradient(const double r, const double v_m, const double v_th, const double height, const double width)
Computes the derivative of an arctan surrogate function as the surrogate gradient.
Definition eprop_archiving_node_recurrent_impl.h:135
void erase_used_firing_rate_reg_history()
Erases the history of the used firing rate regularization history.
Definition eprop_archiving_node_recurrent_impl.h:280
double get_learning_signal_from_history(const long time_step)
Retrieves the learning signal from the eprop history at the specified time step.
Definition eprop_archiving_node_recurrent_impl.h:260
void write_surrogate_gradient_to_history(const long time_step, const double surrogate_gradient)
Writes the surrogate gradient to the eprop history entry at the specified time step.
Definition eprop_archiving_node_recurrent_impl.h:163
double get_firing_rate_reg_history(const long time_step)
Retrieves the firing rate regularization at the specified time step from the firing rate regularizati...
Definition eprop_archiving_node_recurrent_impl.h:250
double compute_fast_sigmoid_derivative_surrogate_gradient(const double r, const double v_m, const double v_th, const double height, const double width)
Computes the derivative of a fast-sigmoid surrogate function as the surrogate gradient.
Definition eprop_archiving_node_recurrent_impl.h:119
Base class implementing archiving for node models supporting e-prop plasticity.
Definition eprop_archiving_node.h:53
void set_status(const Dictionary &d, Node *node, const bool check_eprop_constraint=false)
Sets and validates parameters from the status dictionary.
Definition flush_event_mechanism.cpp:62
void get_status(Dictionary &d) const
Retrieves parameters and adds them to the status dictionary.
Definition flush_event_mechanism.cpp:56
void get_status(Dictionary &d) const
Retrieves parameters and adds them to the status dictionary.
Definition ignore_and_spike_mechanism.cpp:66
void set_status(const Dictionary &d, Node *node)
Sets and validates parameters from the status dictionary.
Definition ignore_and_spike_mechanism.cpp:74
const std::string eprop_isi_trace_cutoff("eprop_isi_trace_cutoff")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
bool update_value_param(Dictionary const &d, const std::string &key, T &value, nest::Node *node)
Obtain value from parameter dictionary including evaluation of random or spatial parameters.
Definition dict_util.h:42
Declarations for base class Node.