output neuron connect to random multiple compute neurons
This commit is contained in:
@@ -43,9 +43,6 @@ function (kfn::kfn_1)(m::model, input_data::AbstractVector)
|
||||
for n in kfn.neuronsArray
|
||||
timestep_forward!(n)
|
||||
end
|
||||
for n in kfn.outputNeuronsArray
|
||||
timestep_forward!(n)
|
||||
end
|
||||
|
||||
# pass input_data into input neuron.
|
||||
# number of data point equals to number of input neuron starting from id 1
|
||||
@@ -71,7 +68,7 @@ function (kfn::kfn_1)(m::model, input_data::AbstractVector)
|
||||
n(kfn)
|
||||
end
|
||||
|
||||
out = [n.out_t1 for n in kfn.outputNeuronsArray]
|
||||
out = [n.z_t1 for n in kfn.outputNeuronsArray]
|
||||
|
||||
return out
|
||||
end
|
||||
@@ -177,7 +174,40 @@ end
|
||||
"""
|
||||
function (n::linear_neuron)(kfn::T) where T<:knowledgeFn
|
||||
n.timeStep = kfn.timeStep
|
||||
n.out_t1 = getindex(kfn.firedNeurons_t1, n.subscriptionList)[1]
|
||||
|
||||
# pulling other neuron's firing status at time t
|
||||
n.z_i_t = getindex(kfn.firedNeurons_t0, n.subscriptionList)
|
||||
n.z_i_t .*= n.subExInType
|
||||
|
||||
if n.refractoryCounter != 0
|
||||
n.refractoryCounter -= 1
|
||||
|
||||
# neuron is in refractory state, skip all calculation
|
||||
n.z_t1 = false # used by timestep_forward() in kfn. Set to zero because neuron spike
|
||||
# last only 1 timestep follow by a period of refractory.
|
||||
n.recSignal = n.recSignal * 0.0
|
||||
|
||||
# Exponantial decay of v_t1
|
||||
n.v_t1 = n.v_t * n.alpha^(n.timeStep - n.lastFiringTime) # or n.v_t1 = n.alpha * n.v_t
|
||||
else
|
||||
n.recSignal = sum(n.w_rec .* n.z_i_t) # signal from other neuron that this neuron subscribed
|
||||
|
||||
n.alpha_v_t = n.alpha * n.v_t
|
||||
n.v_t1 = n.alpha_v_t + n.recSignal
|
||||
n.v_t1 = no_negative!.(n.v_t1)
|
||||
|
||||
if n.v_t1 > n.v_th
|
||||
n.z_t1 = true
|
||||
n.refractoryCounter = n.refractoryDuration
|
||||
n.firingCounter += 1
|
||||
n.v_t1 = n.vRest
|
||||
else
|
||||
n.z_t1 = false
|
||||
end
|
||||
|
||||
# there is a difference from alif formula
|
||||
n.phi = (n.gammaPd / n.v_th) * max(0, 1 - (n.v_t1 - n.v_th) / n.v_th)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user