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

Add pole balancing/reinforcement learning tutorial #1151

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""
iaf_psc_exp - Leaky integrate-and-fire neuron model
###################################################

Description
+++++++++++

...


References
++++++++++

...

See also
++++++++

"""
model iaf_psc_exp_neuron:

state:
V_m mV = E_l # Membrane potential
g_e real = 0.

equations:
g_e' = -g_e / tau_g
V_m' = (g_e * (E_e - V) + E_l - V + I_e + I_stim) / tau_m

parameters:
tau_m ms = 10 ms # Membrane time constant
tau_g ms = 5 ms
E_e mV = 0 mV
E_l mV = -74 mV # Resting potential
V_th mV = -54 mV # Spike threshold potential
V_reset mV = -60 mV

# constant external input current
I_e real = 0

input:
spikes_in_port <- spike
I_stim real <- continuous

output:
spike

update:
integrate_odes()

onReceive(spikes_in_port):
g_e += spikes_in_port * s

onCondition(V_m >= V_th):
# threshold crossing
V_m = V_reset
emit_spike()
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
stdp - Synapse model for spike-timing dependent plasticity
#########################################################

...

"""
model neuromodulated_stdp_synapse:
state:
w real = 1 # Synaptic weight
pre_trace real = 0.
post_trace real = 0.

parameters:
n real = 0. # neuromodulator concentration between 0 and 1
d ms = 1 ms # Synaptic transmission delay
lambda real = .01
tau_tr_pre ms = 20 ms
tau_tr_post ms = 20 ms
alpha real = 1
mu_plus real = 1
mu_minus real = 1
Wmax real = 100.
Wmin real = 0.

equations:
pre_trace' = -pre_trace / tau_tr_pre
post_trace' = -post_trace / tau_tr_post

input:
pre_spikes <- spike
post_spikes <- spike

output:
spike(weight real, delay ms)

onReceive(post_spikes):
post_trace += 1

# potentiate synapse
w_ real = Wmax * ( w / Wmax + n * (lambda * ( 1. - ( w / Wmax ) )**mu_plus * pre_trace ))
w = min(Wmax, w_)

onReceive(pre_spikes):
pre_trace += 1

# depress synapse
w_ real = Wmax * ( w / Wmax - n * ( alpha * lambda * ( w / Wmax )**mu_minus * post_trace ))
w = max(Wmin, w_)

# deliver spike to postsynaptic partner
emit_spike(w, d)

update:
integrate_odes()
Loading
Loading