synaptic connection strength concept

This commit is contained in:
2023-05-17 07:33:03 +07:00
parent b9a140372d
commit dee756adac
4 changed files with 19 additions and 26 deletions

View File

@@ -4,13 +4,13 @@ using Flux.Optimise: apply!
export calculate_α, calculate_ρ, calculate_k, timestep_forward!, init_neuron, no_negative!,
precision, calculate_w_change!, store_knowledgefn_error!, interneurons_adjustment!,
reset_z_t!, resetLearningParams!, reset_learning_history_params!, reset_epsilonRec!,
reset_epsilonRecA!,
reset_epsilonRecA!, synapticConnStrength!,
firing_rate_error!, firing_rate_regulator!, update_Bn!, cal_firing_reg!,
neuroplasticity!, shakeup!, reset_learning_no_wchange!, adjust_internal_learning_rate!,
gradient_withloss
using Statistics, Random, LinearAlgebra, Distributions, Zygote, Flux
using GeneralUtils
using ..types
#------------------------------------------------------------------------------------------------100
@@ -298,22 +298,21 @@ function synapticConnStrength(currentStrength::AbstractFloat, updown::String, bi
return updatedStrength
end
function synapticConnStrength(n::compute_neuron)
function synapticConnStrength!(n::Union{compute_neuron, output_neuron})
for (i, connStrength) in enumerate(n.synapticStrength)
#WORKING
# check whether connStrength increase or decrease based on usage from n.epsilonRec
# compute synaptic strength for this conn
# apply conn lowerlimit and upperlimit
updown = n.epsilonRec[i] == 0.0 ? "down" : "up"
updatedConnStrength = synapticConnStrength(connStrength, updown)
updatedConnStrength = GeneralUtils.limitvalue(updatedConnStrength,
n.synapticStrengthLimit.lowerlimit, n.synapticStrengthLimit.upperlimit)
# at lowerlimit, mark wRec at this position to 0. for new random synaptic conn
if updatedConnStrength == n.synapticStrengthLimit.lowerlimit[1]
n.wRec[i] = 0.0
end
end
end
function synapticConnStrength!(n::input_neuron) end