minimal_init
ReservoirComputing.minimal_init
— Functionminimal_init([rng], [T], dims...;
sampling_type=:bernoulli_sample!, weight=0.1, irrational=pi,
start=1, p=0.5)
Create a layer matrix with uniform weights determined by weight
(Rodan and Tino, 2011). The sign difference is randomly determined by the sampling
chosen.
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 matrix. Should followres_size x in_size
.
Keyword arguments
weight
: The weight used to fill the layer matrix. Default is 0.1.sampling_type
: Sampling that decides the distribution ofweight
negative numbers. If set to:no_sample
the sign is unchanged. If set to:bernoulli_sample!
then eachweight
can be positive with a probability set bypositive_prob
. If set to:irrational_sample!
theweight
is 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
.strides
can be a single number or an array. Default is:no_sample
.positive_prob
: probability of theweight
being positive whensampling_type
is 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 theirrational
sign 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> res_input = minimal_init(8, 3)
8×3 Matrix{Float32}:
0.1 -0.1 0.1
-0.1 0.1 0.1
-0.1 -0.1 0.1
-0.1 -0.1 -0.1
0.1 0.1 0.1
-0.1 -0.1 -0.1
-0.1 -0.1 0.1
0.1 -0.1 0.1
julia> res_input = minimal_init(8, 3; sampling_type = :irrational)
8×3 Matrix{Float32}:
-0.1 0.1 -0.1
0.1 -0.1 -0.1
0.1 0.1 -0.1
0.1 0.1 0.1
-0.1 -0.1 -0.1
0.1 0.1 0.1
0.1 0.1 -0.1
-0.1 0.1 -0.1
julia> res_input = minimal_init(8, 3; p = 0.1) # lower p -> more negative signs
8×3 Matrix{Float32}:
-0.1 -0.1 -0.1
-0.1 -0.1 -0.1
-0.1 -0.1 -0.1
-0.1 -0.1 -0.1
0.1 -0.1 -0.1
-0.1 -0.1 -0.1
-0.1 -0.1 -0.1
-0.1 -0.1 -0.1
julia> res_input = minimal_init(8, 3; p = 0.8)# higher p -> more positive signs
8×3 Matrix{Float32}:
0.1 0.1 0.1
-0.1 0.1 0.1
-0.1 0.1 0.1
0.1 0.1 0.1
0.1 0.1 0.1
0.1 -0.1 0.1
-0.1 0.1 0.1
0.1 0.1 0.1
References
- Rodan, A. and Tino, P. (2011). Minimum Complexity Echo State Network. IEEE Transactions on Neural Networks 22, 131–144.