From 0ac5a703ea0afea0ea9b797a2316332cb23980f7 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Tue, 16 May 2023 21:01:11 +0700 Subject: [PATCH] use LinearAlgebra.normalize!(vector, 1) to adjust weight after weight merge --- src/Ironpen.jl | 16 +++++++++------- src/learn.jl | 3 +++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Ironpen.jl b/src/Ironpen.jl index 10f7d04..20826e5 100644 --- a/src/Ironpen.jl +++ b/src/Ironpen.jl @@ -34,13 +34,8 @@ using .interface """ Todo: - [*6] time-based learning method based on new error formula - (use output vt compared to vth instead of late time) - if output neuron not activate when it should, use output neuron's - (vth - vt)*100/vth as error - if output neuron activates when it should NOT, use output neuron's - (vt*100)/vth as error - [7] use LinearAlgebra.normalize!(vector, 1) to adjust weight after weight merge + + [9] verify that model can complete learning cycle with no error [*5] synaptic connection strength concept. use sigmoid, turn connection offline [8] neuroplasticity() i.e. change connection @@ -56,6 +51,13 @@ using .interface "inference" [DONE] output neuron connect to random multiple compute neurons and overall have the same structure as lif + [DONE] time-based learning method based on new error formula + (use output vt compared to vth instead of late time) + if output neuron not activate when it should, use output neuron's + (vth - vt)*100/vth as error + if output neuron activates when it should NOT, use output neuron's + (vt*100)/vth as error + [DONE] use LinearAlgebra.normalize!(vector, 1) to adjust weight after weight merge Change from version: v06_36a - diff --git a/src/learn.jl b/src/learn.jl index caca34b..6fdcd89 100644 --- a/src/learn.jl +++ b/src/learn.jl @@ -162,6 +162,7 @@ function learn!(n::lif_neuron, error::Number) ΔwRecChange = n.eta * error n.wRecChange = (n.subExInType * n.wRecChange) + ΔwRecChange + LinearAlgebra.normalize!(n.wRecChange, 1) # check for fliped sign, 1 indicates non-fliped sign wSign = sign.(n.wRecChange) @@ -182,6 +183,7 @@ function learn!(n::alif_neuron, error::Number) ΔwRecChange = n.eta * error n.wRecChange = (n.subExInType * n.wRecChange) + ΔwRecChange + LinearAlgebra.normalize!(n.wRecChange, 1) # check for fliped sign, 1 indicates non-fliped sign wSign = sign.(n.wRecChange) @@ -198,6 +200,7 @@ function learn!(n::linear_neuron, error::Number) ΔwRecChange = n.eta * error n.wRecChange = (n.subExInType * n.wRecChange) + ΔwRecChange + LinearAlgebra.normalize!(n.wRecChange, 1) # check for fliped sign, 1 indicates non-fliped sign wSign = sign.(n.wRecChange)