rands
(To be removed) Symmetric random weight/bias initialization function
rands will be removed in a future release. For more information,
see Transition Legacy Neural Network Code to dlnetwork Workflows.
For advice on updating your code, see Version History.
Syntax
W = rands(S,PR)
M = rands(S,R)
v = rands(S)
Description
rands is a weight/bias initialization function.
W = rands(S,PR) takes
S | Number of neurons |
PR |
|
and returns an S-by-R weight matrix of random
values between –1 and 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.
rands(4,[0 1; -2 2]) rands(4) rands(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'rands'.Set each
net.layerWeights{i,j}.initFcnto'rands'.Set each
net.biases{i}.initFcnto'rands'.
To initialize the network, call init.
Version History
Introduced before R2006aVersion History
Introduced before R2006aSee Also
Deep Network
Designer | fitcnet (Statistics and Machine Learning Toolbox) | trainnet | trainingOptions | dlnetwork