This commit is contained in:
2023-05-17 15:55:25 +07:00
parent 95cad151dc
commit a114935b2d
3 changed files with 8 additions and 10 deletions

View File

@@ -52,6 +52,7 @@ function (kfn::kfn_1)(m::model, input_data::AbstractVector)
kfn.firedNeurons_t1 = Vector{Bool}()
kfn.learningStage = "learning"
m.learningStage = kfn.learningStage
end
# generate noise
@@ -131,7 +132,7 @@ function (n::lifNeuron)(kfn::knowledgeFn)
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)
n.v_t1 = no_negative!(n.v_t1)
if n.v_t1 > n.v_th
n.z_t1 = true
@@ -176,7 +177,7 @@ function (n::alifNeuron)(kfn::knowledgeFn)
n.recSignal = sum(n.wRec .* n.z_i_t .* n.subExInType) # 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)
n.v_t1 = no_negative!(n.v_t1)
if n.v_t1 > n.av_th
n.z_t1 = true
n.refractoryCounter = n.refractoryDuration
@@ -221,7 +222,7 @@ function (n::linearNeuron)(kfn::T) where T<:knowledgeFn
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)
n.v_t1 = no_negative!(n.v_t1)
if n.v_t1 > n.v_th
n.z_t1 = true