dev
This commit is contained in:
@@ -106,7 +106,7 @@ function mergeLearnWeight!(wRec::AbstractArray, exInType, wRecChange::AbstractAr
|
||||
synapticActivityCounter::AbstractArray,
|
||||
synapseReconnectDelay::AbstractArray)
|
||||
wRecSigned = exInType .* wRec
|
||||
# -0.0 == 0.0 but isequal() implement as -0.0 != 0.0, so Ineed to get rid of -0.0 manually
|
||||
# -0.0 == 0.0 but isequal() implement as -0.0 != 0.0, so I need to get rid of -0.0 manually
|
||||
GeneralUtils.replaceElements!(wRecSigned, -0, 0)
|
||||
# println("wRec 2 $(size(wRecSigned)) ", wRecSigned[:,:,1,1])
|
||||
# println("wRecChange ", wRecChange[:,:,1,1])
|
||||
@@ -121,18 +121,17 @@ function mergeLearnWeight!(wRec::AbstractArray, exInType, wRecChange::AbstractAr
|
||||
flipsign = (!isequal).(originalsign, newsign)
|
||||
# println("flipsign ", flipsign[:,:,1,1])
|
||||
nonflipsign = (isequal).(originalsign, newsign)
|
||||
wRec .= abs.(wRecSigned)
|
||||
wRec .= abs.(wRecSigned) # wRec store magnitude only, sign is at exInType
|
||||
|
||||
println("wRec 4 $(size(wRec)) ", wRec[:,:,1,1])
|
||||
# println("wRec 4 $(size(wRec)) ", wRec[:,:,1,1])
|
||||
GeneralUtils.replaceElements!(flipsign, 1, wRec, 0.0) # negative synapse get pruned
|
||||
println("wRec 5 $(size(wRec)) ", wRec[:,:,1,1])
|
||||
GeneralUtils.replaceElements!(flipsign, 1, synapticActivityCounter, -0.1)
|
||||
println("synapticActivityCounter ", synapticActivityCounter[:,:,1,1]) #BUG why 0.0 alot?
|
||||
# println("wRec 5 $(size(wRec)) ", wRec[:,:,1,1])
|
||||
GeneralUtils.replaceElements!(flipsign, 1, synapticActivityCounter, 0)
|
||||
# set pruned synapse to random wait time
|
||||
waittime = rand((1:1000), size(wRec)) .* flipsign # synapse's random wait time to reconnect
|
||||
# synapseReconnectDelay counting mode when value is negative hence .* -1
|
||||
synapseReconnectDelay .= (synapseReconnectDelay .* nonflipsign) .+ (waittime .* -1)
|
||||
println("synapseReconnectDelay ", synapseReconnectDelay[:,:,1,1])
|
||||
# println("synapseReconnectDelay ", synapseReconnectDelay[:,:,1,1]) #TODO check value
|
||||
error("DEBUG -> mergeLearnWeight!")
|
||||
end
|
||||
|
||||
@@ -151,7 +150,7 @@ function growRepeatedPath!(wRec, synapticActivityCounter, eta) #BUG wRec get al
|
||||
wRec .*= mask_3
|
||||
|
||||
# -w, synapse with less than 10% of avg activity get reduced weight by eta
|
||||
mask_less = GeneralUtils.isBetween.(synapticActivityCounter, 0.0, lowerlimit) # 1st criteria
|
||||
mask_less = GeneralUtils.isBetween.(synapticActivityCounter, 0, lowerlimit) # 1st criteria
|
||||
mask_3 = GeneralUtils.allTrue.(mask_activeSynapse, mask_less)
|
||||
mask_4 = mask_3 .* (1 .- eta) # minor activity synapse weight will be reduced by eta
|
||||
wRec .*= mask_4
|
||||
@@ -171,7 +170,7 @@ function pruneSynapse!(wRec, synapticActivityCounter, synapseReconnectDelay)
|
||||
mask_notweak = (!GeneralUtils.isBetween).(wRec, 0.0, 0.01)
|
||||
wRec .*= mask_notweak # all marked weak synapse weight need to be 0.0 i.e. pruned
|
||||
# all weak synapse activity are reset
|
||||
GeneralUtils.replaceElements!(mask_weak, 1, synapticActivityCounter, -0.1)
|
||||
GeneralUtils.replaceElements!(mask_weak, 1, synapticActivityCounter, 0)
|
||||
# set pruned synapse to random wait time
|
||||
r = rand((1:1000), size(wRec)) .* mask_weak # synapse's random wait time to reconnect
|
||||
# synapseReconnectDelay counting mode when value is negative hence .* -1
|
||||
@@ -190,7 +189,7 @@ function rewireSynapse!(wRec::AbstractArray, neuronInactivityCounter::AbstractAr
|
||||
w = random_wRec(i1,i2,1,synapseConnectionNumber)
|
||||
wRec[:,:,i,i4] .= w
|
||||
|
||||
a = similar(w) .= -0.1 # synapseConnectionNumber of this neuron
|
||||
a = similar(w) .= -0.1 # temp matrix use to put -0.1 into synapseReconnectDelay
|
||||
mask = (!iszero).(w)
|
||||
GeneralUtils.replaceElements!(mask, 1, a, 0)
|
||||
synapseReconnectDelay[:,:,i,i4] = a
|
||||
|
||||
Reference in New Issue
Block a user