refractoring

This commit is contained in:
2023-05-24 09:28:31 +07:00
parent ed5bdff935
commit ffd366d81a
2 changed files with 7 additions and 6 deletions

View File

@@ -47,9 +47,9 @@ function (kfn::kfn_1)(m::model, input_data::AbstractVector)
end end
# clear variables # clear variables
kfn.firedNeurons = Vector{Int64}() kfn.firedNeurons = Int64[]
kfn.firedNeurons_t0 = Vector{Bool}() kfn.firedNeurons_t0 = Bool[]
kfn.firedNeurons_t1 = Vector{Bool}() kfn.firedNeurons_t1 = Bool[]
kfn.learningStage = "learning" kfn.learningStage = "learning"
m.learningStage = kfn.learningStage m.learningStage = kfn.learningStage

View File

@@ -421,9 +421,10 @@ function neuroplasticity!(n::outputNeuron, firedNeurons::Vector,
# add new synaptic connection to neuron # add new synaptic connection to neuron
for (i, connIndex) in enumerate(zeroWeightConnIndex) for (i, connIndex) in enumerate(zeroWeightConnIndex)
if length(nFiredPool) != 0 newConn::Int64 = 0
newConn = popfirst!(nFiredPool) try
else newConn = popfirst!(nFiredPool)
catch
newConn = popfirst!(nNonFiredPool) newConn = popfirst!(nNonFiredPool)
end end