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 is Utils.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

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
source