backward_connection!
ReservoirComputing.backward_connection! — Function
backward_connection!([rng], reservoir_matrix, weight, shift; signs = nothing)Adds a backward connection in the reservoir_matrix, with given shift and weight. The weight can be a single number or an array.
Arguments
rng: Random number generator. Default isUtils.default_rng()from WeightInitializers.reservoir_matrix: matrix to be changed.weight: weight to add as a backward connection. Can be either a single number or an array.shift: How far the backward connection will be from the diagonal.
Keyword arguments
signs: Controls sign flips. UseRandomSigns,RegularSigns, orIrrationalDigitSigns. Passnothingto leave signs unchanged. Default isnothing.
Examples
julia> matrix = zeros(Float32, 5, 5)
5×5 Matrix{Float32}:
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
julia> backward_connection!(matrix, 3.0, 1)
5×5 Matrix{Float32}:
0.0 3.0 0.0 0.0 0.0
0.0 0.0 3.0 0.0 0.0
0.0 0.0 0.0 3.0 0.0
0.0 0.0 0.0 0.0 3.0
0.0 0.0 0.0 0.0 0.0
julia> backward_connection!(matrix, 3.0, 1; signs = RandomSigns())
5×5 Matrix{Float32}:
0.0 3.0 0.0 0.0 0.0
0.0 0.0 -3.0 0.0 0.0
0.0 0.0 0.0 3.0 0.0
0.0 0.0 0.0 0.0 -3.0
0.0 0.0 0.0 0.0 0.0