version 0.0.7

This commit is contained in:
ton
2023-08-29 19:52:52 +07:00
parent 2f89905dc9
commit 619e8d7f83
14 changed files with 4013 additions and 35 deletions

View File

@@ -52,13 +52,6 @@ function addNewSynapticConn!(mask::AbstractArray{<:Any}, x::Number, wRec::Abstra
# println("n ", n, size(n))
# println("")
total_x_tobeReplced = sum(isequal.(mask, x))
remaining = 0
if n == 0 || n > total_x_tobeReplced
remaining = n - total_x_tobeReplced
n = total_x_tobeReplced
end
# check if mask and wRec have the same size
if size(mask) != size(wRec)
error("mask and wRec must have the same size")
@@ -68,15 +61,22 @@ function addNewSynapticConn!(mask::AbstractArray{<:Any}, x::Number, wRec::Abstra
alreadySub = findall(x -> x != 0, wRec) # get already subscribe
setdiff!(indices, alreadySub) # remove already sub conn from pool
remaining = 0
if n == 0 || n > length(indices)
remaining = n - length(indices)
n = length(indices)
end
# shuffle the indices using the rng function
shuffle!(rng, indices)
# select the first n indices
n > length(indices) ? println(">>> ", total_x_tobeReplced) : nothing
selected = indices[1:n]
# replace the elements in wRec at the selected positions with a
for i in selected
wRec[i] = rand(0.01:0.01:0.1)
if counter !== nothing
counter[i] = 0 # reset
counter[i] = 0 # counting start from 0
end
end
# error("DEBUG addNewSynapticConn!")