selfloopdelaylinebackward
ReservoirComputing.selfloop_delayline_backward — Functionselfloop_delayline_backward([rng], [T], dims...;
weight=0.1, selfloop_weight=0.1, fb_weight=0.1,
fb_shift=2, return_sparse=false, fb_kwargs=(),
selfloop_kwargs=(), delay_kwargs=())Creates a reservoir based on a delay line with the addition of self loops and backward connections shifted by one (Elsarraj et al., 2019).
This architecture is referred to as TP3 in the original paper.
Equations
\[W_{i,j} = \begin{cases} ll, & \text{if } i = j \text{ for } i = 1 \dots N \\ r, & \text{if } j = i - 1 \text{ for } i = 2 \dots N \\ r, & \text{if } j = i - 2 \text{ for } i = 3 \dots N \\ 0, & \text{otherwise} \end{cases}\]
Arguments
rng: Random number generator. Default isUtils.default_rng()from WeightInitializers.T: Type of the elements in the reservoir matrix. Default isFloat32.dims: Dimensions of the reservoir matrix.
Keyword arguments
weight: Weight of the cycle connections in the reservoir matrix. This can be provided as a single value or an array. In case it is provided as an array please make sure that the length of the array matches the length of the cycle you want to populate. Default is 0.1.selfloop_weight: Weight of the self loops in the reservoir matrix. This can be provided as a single value or an array. In case it is provided as an array please make sure that the length of the array matches the length of the diagonal you want to populate. Default is 0.1.fb_weight: Weight of the feedback in the reservoir matrix. This can be provided as a single value or an array. In case it is provided as an array please make sure that the length of the array matches the length of the diagonal you want to populate. Default is 0.1.fb_shift: How far the backward connection will be from the diagonal. Default is 2.return_sparse: flag for returning asparsematrix. Default isfalse.delay_kwargs,selfloop_kwargs, andfb_kwargs: named tuples that control the kwargs for the weights generation. The kwargs are as follows:sampling_type: Sampling that decides the distribution ofweightnegative numbers. If set to:no_samplethe sign is unchanged. If set to:bernoulli_sample!then eachweightcan be positive with a probability set bypositive_prob. If set to:irrational_sample!theweightis negative if the decimal number of the irrational number chosen is odd. If set to:regular_sample!, each weight will be assigned a negative sign after the chosenstrides.stridescan be a single number or an array. Default is:no_sample.positive_prob: probability of theweightbeing positive whensampling_typeis set to:bernoulli_sample!. Default is 0.5.irrational: Irrational number whose decimals decide the sign ofweight. Default ispi.start: Which place after the decimal point the counting starts for theirrationalsign counting. Default is 1.strides: number of strides for assigning negative value to a weight. It can be an integer or an array. Default is 2.
Examples
julia> reservoir_matrix = selfloop_delayline_backward(5, 5)
5×5 Matrix{Float32}:
0.1 0.0 0.1 0.0 0.0
0.1 0.1 0.0 0.1 0.0
0.0 0.1 0.1 0.0 0.1
0.0 0.0 0.1 0.1 0.0
0.0 0.0 0.0 0.1 0.1
julia> reservoir_matrix = selfloop_delayline_backward(5, 5; weight=0.3)
5×5 Matrix{Float32}:
0.1 0.0 0.3 0.0 0.0
0.3 0.1 0.0 0.3 0.0
0.0 0.3 0.1 0.0 0.3
0.0 0.0 0.3 0.1 0.0
0.0 0.0 0.0 0.3 0.1References
- Elsarraj, D.; Qisi, M. A.; Rodan, A.; Obeid, N.; Sharieh, A. and Faris, H. (2019). Demystifying echo state network with deterministic simple topologies. International Journal of Computational Science and Engineering 19, 407–417.