Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

setwb

Set all network weight and bias values with single vector

Syntax

net = setwb(net,wb)

Description

This function sets a network's weight and biases to a vector of values.

net = setwb(net,wb) takes the following inputs:

net

Neural network

wb

Vector of weight and bias values

Examples

Set Network's Weights and Biases

This example shows how to set and view a network's weight and bias values.

Create and configure a network.

[x,t] = simplefit_dataset;
net = feedforwardnet(3);
net = configure(net,x,t);
view(net)

This network has three weights and three biases in the first layer, and three weights and one bias in the second layer. So, the total number of weight and bias values in the network is 10. Set the weights and biases to random values.

net = setwb(net,rand(10,1));

View the weight and bias values

net.IW{1,1}
net.b{1}
ans =

    0.1576
    0.9706
    0.9572


ans =

    0.5469
    0.9575
    0.9649

See Also

| |

Introduced in R2010b

Was this topic helpful?