This commit is contained in:
ton
2023-09-24 15:25:12 +07:00
parent c165afaa11
commit 2b15510669

View File

@@ -287,7 +287,7 @@ function learn!(kfn::kfn_1, progress, device=cpu)
println("on_synapticActivityCounter 0 ", kfn.on_synapticActivityCounter[:,:,1])
println("on_synapticActivityCounter 5 ", kfn.on_synapticActivityCounter[:,:,6])
println("wOut 0 ", sum(kfn.on_wOut[:,:,1,1], dims=3))
println("wOut 5 ", sum(kfn.on_wOut[:,:,1,1], dims=3))
println("wOut 5 ", sum(kfn.on_wOut[:,:,6,1], dims=3))
end
#WORKING compare output neuron 0 synapse activity when input are label 0 and 5, (!isequal).(wOut)
@@ -479,7 +479,7 @@ function neuroplasticity(synapseConnectionNumber,
#TODO I may need to do something with neuronInactivityCounter and other variables
wRecChange .= 0
# error("DEBUG -> neuroplasticity")
elseif progress != 0 # progress increase
elseif progress == 1 # some progress whether up or down
# ready to reconnect synapse must not have wRecChange
mask = (!isequal).(wRec, 0)
wRecChange .*= mask
@@ -501,8 +501,7 @@ function neuroplasticity(synapseConnectionNumber,
synapseReconnectDelay, synapseConnectionNumber, zitCumulative)
# error("DEBUG -> neuroplasticity 1")
elseif progress == 0 # no progress, no weight update, only rewire
# #TESTING -w all non-fire connection except mature connection
# weakenNotMatureSynapse!(wRec, synapticActivityCounter, eta)
wRecChange .= 0
# prune weak synapse
pruneSynapse!(wRec, synapticActivityCounter, synapseReconnectDelay)
@@ -512,6 +511,27 @@ function neuroplasticity(synapseConnectionNumber,
synapseReconnectDelay, synapseConnectionNumber, zitCumulative)
# error("DEBUG -> neuroplasticity")
elseif progress == -1 # some progress whether up or down
# ready to reconnect synapse must not have wRecChange
mask = (!isequal).(wRec, 0)
wRecChange .*= mask
# merge learning weight, all resulting negative wRec will get pruned
mergeLearnWeight!(wRec, exInType, wRecChange, synapticActivityCounter, synapseReconnectDelay)
# adjust wRec based on repeatition (90% +w, 10% -w)
growRepeatedPath!(wRec, synapticActivityCounter, eta)
# -w all non-fire connection except mature connection
weakenNotMatureSynapse!(wRec, synapticActivityCounter, eta)
# prune weak synapse
pruneSynapse!(wRec, synapticActivityCounter, synapseReconnectDelay)
# rewire synapse connection
rewireSynapse!(wRec, neuronInactivityCounter, synapticActivityCounter,
synapseReconnectDelay, synapseConnectionNumber, zitCumulative)
# error("DEBUG -> neuroplasticity 1")
else
error("undefined condition line $(@__LINE__)")
end