bug fix synapticConnStrength!()

This commit is contained in:
2023-05-18 11:14:50 +07:00
parent d1fe518739
commit 7db310d465
4 changed files with 33 additions and 12 deletions

View File

@@ -322,6 +322,7 @@ Base.@kwdef mutable struct lifNeuron <: computeNeuron
# during v_t1 calculation hence I need a variable to hold z_t1 so that I'm not replacing z_t
z_t1::Bool = false # neuron postsynaptic firing at current timestep (after neuron's calculation)
z_i_t::Union{Array{Bool},Nothing} = nothing # neuron presynaptic firing at current timestep (which is other neuron postsynaptic firing of previous timestep)
z_i_t_commulative::Union{Array{Integer},Nothing} = nothing # used to compute connection strength
synapticStrength::Union{Array{Float64},Nothing} = nothing
synapticStrengthLimit::Union{NamedTuple,Nothing} = (lowerlimit=(0=>0), upperlimit=(10=>10))
@@ -413,6 +414,7 @@ Base.@kwdef mutable struct alifNeuron <: computeNeuron
# during v_t1 calculation hence I need a variable to hold z_t1 so that I'm not replacing z_t
z_t1::Bool = false # neuron postsynaptic firing at current timestep (after neuron's calculation)
z_i_t::Union{Array{Bool},Nothing} = nothing # neuron presynaptic firing at current timestep (which is other neuron postsynaptic firing of previous timestep)
z_i_t_commulative::Union{Array{Integer},Nothing} = nothing # used to compute connection strength
synapticStrength::Union{Array{Float64},Nothing} = nothing
synapticStrengthLimit::Union{NamedTuple,Nothing} = (lowerlimit=(-5=>0), upperlimit=(5=>5))
@@ -523,6 +525,7 @@ Base.@kwdef mutable struct linearNeuron <: outputNeuron
# neuron presynaptic firing at current timestep (which is other neuron postsynaptic firing of
# previous timestep)
z_i_t::Union{Array{Bool},Nothing} = nothing
z_i_t_commulative::Union{Array{Integer},Nothing} = nothing # used to compute connection strength
synapticStrength::Union{Array{Float64},Nothing} = nothing
synapticStrengthLimit::Union{NamedTuple,Nothing} = (lowerlimit=(-5=>-5), upperlimit=(5=>5))
@@ -630,6 +633,7 @@ function init_neuron!(id::Int64, n::lifNeuron, n_params::Dict, kfnParams::Dict)
n.wRec = rand(-0.2:0.01:0.2, length(n.subscriptionList))
n.wRecChange = zeros(length(n.subscriptionList))
n.alpha = calculate_α(n)
n.z_i_t_commulative = zeros(length(n.subscriptionList))
end
function init_neuron!(id::Int64, n::alifNeuron, n_params::Dict,
@@ -654,6 +658,7 @@ function init_neuron!(id::Int64, n::alifNeuron, n_params::Dict,
n.alpha = calculate_α(n)
n.rho = calculate_ρ(n)
n.epsilonRecA = zeros(length(n.subscriptionList))
n.z_i_t_commulative = zeros(length(n.subscriptionList))
end
@@ -671,6 +676,7 @@ function init_neuron!(id::Int64, n::linearNeuron, n_params::Dict, kfnParams::Dic
n.wRec = rand(-0.2:0.01:0.2, length(n.subscriptionList))
n.wRecChange = zeros(length(n.subscriptionList))
n.alpha = calculate_k(n)
n.z_i_t_commulative = zeros(length(n.subscriptionList))
end
""" Make a neuron intended for use with knowledgeFn