weighted_minimal
ReservoirComputing.weighted_minimal — Function
weighted_minimal([rng], [T], dims...;
weight=0.1, return_sparse=false,
signs = nothing)Create and return a minimal weighted input layer matrix. This initializer generates a weighted input matrix with equal, deterministic elements in the same construction as [weighted_minimal](@ref), inspired by (Lu et al., 2017). Blocks are distributed as in weighted_init, and an ArgumentError is thrown if res_size < in_size.
Arguments
rng: Random number generator. Default isXoshiro(1234).T: Type of the elements in the reservoir matrix. Default isFloat32.dims: Dimensions of the matrix. Should followres_size x in_size.
Keyword arguments
weight: The value for all the weights in the input matrix. Defaults to0.1.return_sparse: flag for returning asparsematrix. Default isfalse.signs: Controls sign flips. UseRandomSigns,RegularSigns, orIrrationalDigitSigns. Passnothingto leave signs unchanged. Default isnothing.
Examples
Standard call, changing the init weight:
julia> using Random, Test
julia> using ReservoirComputing: RandomSigns, weighted_minimal
julia> res_input = weighted_minimal(MersenneTwister(11), Float32, 9, 3; weight = 0.99);
julia> size(res_input) == (9, 3) && all(count(!iszero, column) == 3 for column in eachcol(res_input)) && all(iszero(weight) || weight == 0.99f0 for weight in res_input)
trueRandom sign flips for each weight:
julia> res_input = weighted_minimal(
MersenneTwister(12), Float32, 9, 3; signs = RandomSigns());
julia> all(count(!iszero, column) == 3 for column in eachcol(res_input)) &&
all(weight -> iszero(weight) || abs(weight) == 0.1f0, res_input)
trueWhen res_size is not a multiple of in_size, the first res_size % in_size columns connect to one more reservoir node than the others:
julia> res_input = weighted_minimal(MersenneTwister(13), Float32, 8, 3);
julia> size(res_input) == (8, 3) && [count(!iszero, column) for column in eachcol(res_input)] == [3, 3, 2]
trueReferences
- Lu, Z.; Pathak, J.; Hunt, B.; Girvan, M.; Brockett, R. and Ott, E. (2017). Reservoir observers: Model-free inference of unmeasured variables in chaotic systems. Chaos: An Interdisciplinary Journal of Nonlinear Science 27.