add normalizePeak!
This commit is contained in:
@@ -4,7 +4,7 @@ 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!, synapticConnStrength!,
|
||||
reset_epsilonRecA!, synapticConnStrength!, normalizePeak!,
|
||||
firing_rate_error!, firing_rate_regulator!, update_Bn!, cal_firing_reg!,
|
||||
neuroplasticity!, shakeup!, reset_learning_no_wchange!, adjust_internal_learning_rate!,
|
||||
gradient_withloss
|
||||
@@ -317,7 +317,18 @@ function neuroplasticity!(n::compute_neuron, firedNeurons::Vector)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
""" normalize a part of a vector centering at a vector's maximum value along with nearby value
|
||||
within its radius. radius must be odd number
|
||||
"""
|
||||
function normalizePeak!(v::Vector, radius::Integer=2)
|
||||
peak = findall(isequal.(n.wRec, maximum(n.wRec)))[1]
|
||||
upindex = peak - radius
|
||||
upindex = upindex < 1 ? 1 : upindex
|
||||
downindex = peak + radius
|
||||
downindex = downindex > length(v) ? length(v) : downindex
|
||||
subvector = view(v, upindex:downindex)
|
||||
normalize!(subvector, 1)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user