This commit is contained in:
2023-09-15 15:51:15 +07:00
parent 9ff567322d
commit 7ad96f8622

View File

@@ -567,6 +567,7 @@ function onLearn!(wOut,
end end
alltrue(args...) = false [args...] ? false : true alltrue(args...) = false [args...] ? false : true
isbetween(x, lowerlimit, upperlimit) = lowerlimit < x < upperlimit ? true : false
#WORKING 1) implement 90% +w, 10% -w 2) rewrite this function #WORKING 1) implement 90% +w, 10% -w 2) rewrite this function
function neuroplasticity(synapseConnectionNumber, function neuroplasticity(synapseConnectionNumber,
@@ -609,7 +610,7 @@ function neuroplasticity(synapseConnectionNumber,
# -w, synapse with less than 10% of avg activity get reduced weight by eta # -w, synapse with less than 10% of avg activity get reduced weight by eta
mask_less = isless.(synapticActivityCounter, lowerlimit) # 1st criteria mask_less = isless.(synapticActivityCounter, lowerlimit) # 1st criteria
mask_3 = alltrue.(mask_activeSynapse, mask_less) mask_3 = alltrue.(mask_activeSynapse, mask_less)
mask_3 .*= 1 .- eta # minor activity synapse weight will be reduced by eta mask_3 .*= 1 .- eta # minor activity synapse weight will be reduced by eta
wRec .*= mask_3 wRec .*= mask_3
@@ -622,6 +623,7 @@ function neuroplasticity(synapseConnectionNumber,
# prune weak connection # prune weak connection
# mark weak / negative synaptic connection so they will get randomed in neuroplasticity() # mark weak / negative synaptic connection so they will get randomed in neuroplasticity()
mask = isbetween.(wRec, 0.0, 0.01)
wRec = GeneralUtils.replaceBetween.(wRec, 0.0, 0.01, -1.0) # mark with -1.0 wRec = GeneralUtils.replaceBetween.(wRec, 0.0, 0.01, -1.0) # mark with -1.0
#WORKING rewire synapse connection #WORKING rewire synapse connection