refractoring

This commit is contained in:
2023-05-16 23:24:56 +07:00
parent f53adf288d
commit fbc40ccef4
3 changed files with 4 additions and 12 deletions

View File

@@ -166,6 +166,8 @@ function (n::alif_neuron)(kfn::knowledgeFn)
n.phi = (n.gammaPd / n.v_th) * max(0, 1 - (n.v_t1 - n.av_th) / n.v_th) n.phi = (n.gammaPd / n.v_th) * max(0, 1 - (n.v_t1 - n.av_th) / n.v_th)
n.decayedEpsilonRec = n.alpha * n.epsilonRec n.decayedEpsilonRec = n.alpha * n.epsilonRec
n.epsilonRec = n.decayedEpsilonRec + n.z_i_t n.epsilonRec = n.decayedEpsilonRec + n.z_i_t
n.epsilonRecA = (n.phi * n.epsilonRec) +
((n.rho - (n.phi * n.beta)) * n.epsilonRecA)
end end
end end

View File

@@ -140,8 +140,6 @@ end
""" alif_neuron learn() """ alif_neuron learn()
""" """
function learn!(n::alif_neuron, error::Number) function learn!(n::alif_neuron, error::Number)
n.epsilonRecA = (n.phi * n.epsilonRec) +
((n.rho - (n.phi * n.beta)) * n.epsilonRecA)
n.eRec_v = n.phi * n.epsilonRec n.eRec_v = n.phi * n.epsilonRec
n.eRec_a = -n.phi * n.beta * n.epsilonRecA n.eRec_a = -n.phi * n.beta * n.epsilonRecA
n.eRec = n.eRec_v + n.eRec_a n.eRec = n.eRec_v + n.eRec_a

View File

@@ -274,14 +274,6 @@ function adjust_internal_learning_rate!(n::compute_neuron)
n.internal_learning_rate * 1.005 n.internal_learning_rate * 1.005
end end
function push_epsilon_rec_a!(n::lif_neuron)
# skip
end
function push_epsilon_rec_a!(n::alif_neuron)
push!(n.epsilonRecA, 0)
end
""" compute synaptic connection strength. bias will shift currentStrength to fit into """ compute synaptic connection strength. bias will shift currentStrength to fit into
sigmoid operating range which centred at 0 and range is -37 to 37. sigmoid operating range which centred at 0 and range is -37 to 37.
# Example # Example
@@ -307,8 +299,8 @@ function synapticConnStrength(currentStrength::AbstractFloat, updown::String, bi
end end
function synapticConnStrength(n::compute_neuron) function synapticConnStrength(n::compute_neuron)
for connStrength in n.synapticStrength for (i, connStrength) in enumerate(n.synapticStrength)
n.
synapticConnStrength synapticConnStrength