Main Content

init

Initialize neural network

Description

example

init_net= init (net)returns a neural networknetwith weight and bias values updated according to the network initialization function, specified bynet.initFcn, and the parameter values, specified bynet.initParam.

For more information on this function, at the MATLAB command prompt, typehelp network/init.

Examples

collapse all

This example shows how to reinitialize a perceptron network by using theinitfunction.

Create a perceptron and configure it 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); net.iw{1,1} net.b{1}

Train the perceptron to alter its weight and bias values.

net = train(net,x,t); net.iw{1,1} net.b{1}

initreinitializes those weight and bias values.

net = init(net); net.iw{1,1} net.b{1}

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

Input Arguments

collapse all

Input network, specified as a network object. To create a network object, use for example,feedforwardnetornarxnet.

Output Arguments

collapse all

Network after theinitreinitialization, returned as a network object.

Algorithms

initcallsnet.initFcnto initialize the weight and bias values according to the parameter valuesnet.initParam.

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

Backpropagation networks havenet.layers{i}.initFcnset to'initnw', which calculates the weight and bias values for layeriusing the Nguyen-Widrow initialization method.

Other networks havenet.layers{i}.initFcnset to'initwb', which initializes each weight and bias with its own initialization function. The most common weight and bias initialization function isrands, which generates random values between –1 and 1.

Version History

Introduced before R2006a