This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Initialize neural network


net = init(net)

To Get Help

Type help network/init.


net = init(net) returns neural network net with weight and bias values updated according to the network initialization function, indicated by net.initFcn, and the parameter values, indicated by net.initParam.


Here a perceptron is created, and then configured so that its input, output, weight, and bias dimensions match the input and target data.

x = [0 1 0 1; 0 0 1 1];
t = [0 0 0 1];
net = perceptron;
net = configure(net,x,t);

Training the perceptron alters its weight and bias values.

net = train(net,x,t);

init reinitializes those weight and bias values.

net = init(net);

The weights and biases are zeros again, which are the initial values used by perceptron networks.


init calls net.initFcn to initialize the weight and bias values according to the parameter values net.initParam.

Typically, net.initFcn is set to 'initlay', which initializes each layer’s weights and biases according to its net.layers{i}.initFcn.

Backpropagation networks have net.layers{i}.initFcn set to 'initnw', which calculates the weight and bias values for layer i using the Nguyen-Widrow initialization method.

Other networks have net.layers{i}.initFcn set to 'initwb', which initializes each weight and bias with its own initialization function. The most common weight and bias initialization function is rands, which generates random values between –1 and 1.

See Also

| | | | | | |

Introduced before R2006a