This commit is contained in:
2023-05-17 22:41:09 +07:00
parent e47ab2a855
commit 9539b1b39b
4 changed files with 27 additions and 26 deletions

View File

@@ -512,6 +512,7 @@ Base.@kwdef mutable struct linearNeuron <: outputNeuron
v_t1::Float64 = rand() # vᵗ⁺¹, postsynaptic neuron membrane potential at current timestep
v_th::Float64 = 1.0 # vᵗʰ, neuron firing threshold
vRest::Float64 = 0.0 # resting potential after neuron fired
vError::Union{Float64,Nothing} = nothing # used to compute model error
z_t::Bool = false # zᵗ, neuron postsynaptic firing of previous timestep
# zᵗ⁺¹, neuron firing status at time = t+1. I need this because the way I calculate all
# neurons forward function at each timestep-by-timestep is to do every neuron
@@ -539,7 +540,6 @@ Base.@kwdef mutable struct linearNeuron <: outputNeuron
wRecChange::Union{Array{Float64},Nothing} = nothing # Δw_rec, cumulated wRec change
recSignal::Union{Float64,Nothing} = nothing # incoming recurrent signal
alpha_v_t::Union{Float64,Nothing} = nothing # alpha * v_t
error::Union{Float64,Nothing} = nothing # local neuron error
firingCounter::Integer = 0 # store how many times neuron fires
end
@@ -627,7 +627,7 @@ function init_neuron!(id::Int64, n::lifNeuron, n_params::Dict, kfnParams::Dict)
n.synapticStrength = rand(-5:0.1:-3, length(n.subscriptionList))
n.epsilonRec = zeros(length(n.subscriptionList))
n.wRec = rand(length(n.subscriptionList))
n.wRec = rand(-0.2:0.01:0.2, length(n.subscriptionList))
n.wRecChange = zeros(length(n.subscriptionList))
n.alpha = calculate_α(n)
end
@@ -646,7 +646,7 @@ function init_neuron!(id::Int64, n::alifNeuron, n_params::Dict,
n.synapticStrength = rand(-5:0.1:-3, length(n.subscriptionList))
n.epsilonRec = zeros(length(n.subscriptionList))
n.wRec = rand(length(n.subscriptionList))
n.wRec = rand(-0.2:0.01:0.2, length(n.subscriptionList))
n.wRecChange = zeros(length(n.subscriptionList))
# the more time has passed from the last time neuron was activated, the more
@@ -668,7 +668,7 @@ function init_neuron!(id::Int64, n::linearNeuron, n_params::Dict, kfnParams::Dic
n.synapticStrength = rand(-5:0.1:-3, length(n.subscriptionList))
n.epsilonRec = zeros(length(n.subscriptionList))
n.wRec = rand(length(n.subscriptionList))
n.wRec = rand(-0.2:0.01:0.2, length(n.subscriptionList))
n.wRecChange = zeros(length(n.subscriptionList))
n.alpha = calculate_k(n)
end