use LinearAlgebra.normalize!(vector, 1) to adjust weight after weight merge

This commit is contained in:
2023-05-16 21:01:11 +07:00
parent 70d2521c5e
commit 0ac5a703ea
2 changed files with 12 additions and 7 deletions

View File

@@ -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)