experimenting compute neuron association

This commit is contained in:
2023-05-25 21:23:43 +07:00
parent d12ba02efd
commit 3556167591
5 changed files with 60 additions and 37 deletions

View File

@@ -14,11 +14,11 @@ function (m::model)(input_data::AbstractVector)
m.timeStep += 1
# process all corresponding KFN
raw_model_respond, outputNeuron_v_t1 = m.knowledgeFn[:I](m, input_data)
# raw_model_respond, outputNeuron_v_t1, firedNeurons_t1 = m.knowledgeFn[:I](m, input_data)
# the 2nd return (KFN error) should not be used as model error but I use it because there is
# only one KFN in a model right now
return raw_model_respond::Array{Bool}, outputNeuron_v_t1::Array{Float64}
return m.knowledgeFn[:I](m, input_data)
end
#------------------------------------------------------------------------------------------------100
@@ -96,7 +96,8 @@ function (kfn::kfn_1)(m::model, input_data::AbstractVector)
out = [n.z_t1 for n in kfn.outputNeuronsArray]
outputNeuron_v_t1 = [n.v_t1 for n in kfn.outputNeuronsArray]
return out::Array{Bool}, outputNeuron_v_t1::Array{Float64}
return out::Array{Bool}, outputNeuron_v_t1::Array{Float64}, sum(kfn.firedNeurons_t1),
kfn.exSignalSum, kfn.inSignalsum
end
#------------------------------------------------------------------------------------------------100
@@ -220,7 +221,18 @@ function (n::linearNeuron)(kfn::T) where T<:knowledgeFn
n.v_t1 = n.alpha * n.v_t
n.vError = n.v_t1 # store voltage that will be used to calculate error later
else
n.recSignal = sum(n.wRec .* n.z_i_t) # signal from other neuron that this neuron subscribed
recSignal = n.wRec .* n.z_i_t
if n.id == 1 #FIXME debugging output neuron dead
for i in recSignal
if i > 0
kfn.exSignalSum += i
elseif i < 0
kfn.inSignalsum += i
else
end
end
end
n.recSignal = sum(recSignal) # 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)