randsmall
Small random weight/bias initialization function
Syntax
W = randsmall(S,PR)
M = rands(S,R)
v = rands(S)
Description
randsmall is a weight/bias initialization function.
W = randsmall(S,PR) takes
S | Number of neurons |
PR |
|
and returns an S-by-R weight matrix of small random
values between –0.1 and 0.1.
M = rands(S,R) returns an S-by-R
matrix of random values. v = rands(S) returns an S-by-1
vector of random values.
Examples
Here three sets of random values are generated with rands.
randsmall(4,[0 1; -2 2]) randsmall(4) randsmall(2,3)
Network Use
To prepare the weights and the bias of layer i of a custom network to be
initialized with rands,
Set
net.initFcnto'initlay'. (net.initParamautomatically becomesinitlay’s default parameters.)Set
net.layers{i}.initFcnto'initwb'.Set each
net.inputWeights{i,j}.initFcnto'randsmall'.Set each
net.layerWeights{i,j}.initFcnto'randsmall'.Set each
net.biases{i}.initFcnto'randsmall'.
To initialize the network, call init.
Version History
Introduced in R2010b