refractoring
This commit is contained in:
15
src/types.jl
15
src/types.jl
@@ -529,7 +529,7 @@ Base.@kwdef mutable struct linear_neuron <: output_neuron
|
||||
# previous timestep)
|
||||
z_i_t::Union{Array{Bool},Nothing} = nothing
|
||||
synapticStrength::Union{Array{Float64},Nothing} = nothing
|
||||
synapticStrengthLimit::Union{NamedTuple,Nothing} = (lowerlimit=(-5=>0), upperlimit=(5=>5))
|
||||
synapticStrengthLimit::Union{NamedTuple,Nothing} = (lowerlimit=(-5=>-5), upperlimit=(5=>5))
|
||||
|
||||
gammaPd::Union{Float64,Nothing} = 0.3 # γ_pd, discount factor, value from paper
|
||||
alpha::Union{Float64,Nothing} = nothing # α, neuron membrane potential decay factor
|
||||
@@ -630,10 +630,10 @@ function init_neuron!(id::Int64, n::lif_neuron, n_params::Dict, kfnParams::Dict)
|
||||
|
||||
# prevent subscription to itself by removing this neuron id
|
||||
filter!(x -> x != n.id, n.subscriptionList)
|
||||
n.synapticStrength = normalize!(rand(length(n.subscriptionList)), 1)
|
||||
n.synapticStrength = rand(-5:0.1:-3, length(n.subscriptionList))
|
||||
|
||||
n.epsilonRec = zeros(length(n.subscriptionList))
|
||||
n.wRec = Random.rand(length(n.subscriptionList))
|
||||
n.wRec = LinearAlgebra.normalize!(rand(length(n.subscriptionList)), 1)
|
||||
n.wRecChange = zeros(length(n.subscriptionList))
|
||||
n.alpha = calculate_α(n)
|
||||
end
|
||||
@@ -649,10 +649,10 @@ function init_neuron!(id::Int64, n::alif_neuron, n_params::Dict,
|
||||
|
||||
# prevent subscription to itself by removing this neuron id
|
||||
filter!(x -> x != n.id, n.subscriptionList)
|
||||
n.synapticStrength = normalize!(rand(length(n.subscriptionList)), 1)
|
||||
n.synapticStrength = rand(-5:0.1:-3, length(n.subscriptionList))
|
||||
|
||||
n.epsilonRec = zeros(length(n.subscriptionList))
|
||||
n.wRec = Random.rand(length(n.subscriptionList))
|
||||
n.wRec = LinearAlgebra.normalize!(rand(length(n.subscriptionList)), 1)
|
||||
n.wRecChange = zeros(length(n.subscriptionList))
|
||||
|
||||
# the more time has passed from the last time neuron was activated, the more
|
||||
@@ -671,9 +671,10 @@ function init_neuron!(id::Int64, n::linear_neuron, n_params::Dict, kfnParams::Di
|
||||
subscription_numbers = Int(floor(n_params[:synaptic_connection_number] *
|
||||
kfnParams[:total_compute_neuron] / 100.0))
|
||||
n.subscriptionList = [pop!(subscription_options) for i = 1:subscription_numbers]
|
||||
n.synapticStrength = normalize!(rand(length(n.subscriptionList)), 1)
|
||||
n.synapticStrength = rand(-5:0.1:-3, length(n.subscriptionList))
|
||||
|
||||
n.epsilonRec = zeros(length(n.subscriptionList))
|
||||
n.wRec = Random.rand(length(n.subscriptionList))
|
||||
n.wRec = LinearAlgebra.normalize!(rand(length(n.subscriptionList)), 1)
|
||||
n.wRecChange = zeros(length(n.subscriptionList))
|
||||
n.alpha = calculate_k(n)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user