Training neural network output and weight

Hello,
i have run neural network using this code:
Filename='Data_jst.xlsx';
xlRange='M2:S55';
data=xlsread(Filename,xlRange);
dd=data(:,1:5)'
ddtarget=data(:,6:7)'
mindd=min(min(dd));
maxdd=max(max(dd));
input=(0.8*(dd-mindd)/(maxdd-mindd)+0.1);
net=newff(minmax(input),[5 6 2],{'tansig','tansig','tansig'},'trainrp');
net.trainparam.goal=0.001;
net=train(net,dd,ddtarget);
the question is, the progress results (mse performance and epoch) always different when i tried rerun it everytime, is this expected behaviour from neural network itself?
i read in order to obtain the best result, the initial weights and biases value are random numbers between [-1 and +1] or [-0,5 and +0,5] range.
but in my case, using WB=getwb(net) to show my weight, the values are more than [-1, +1] or [-0,5, +0,5].
so should i set the weight between [-1, +1] or [-0,5, +0,5], and how to set the weight and bias number to that range?

Answers (1)

Hi Ananda,
It is expected behavior for the performance (MSE) and number of epochs to vary between runs when training a neural network. This variability is caused because the initial weights and biases of the network are randomly initialized, leading to different starting points for the optimization process each time you train the network.
To set the weight and bias values to specific values you can use the “setwb” function which takes the neural network and a vector of weight and bias values as input. Please run the following command in command window to open the documentation for setwb” function -
doc setwb

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Release

R2016b

Asked:

on 7 Mar 2021

Answered:

on 20 Dec 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!