Training neural network output and weight

1 回表示 (過去 30 日間)
Ananda Bagaswoto
Ananda Bagaswoto 2021 年 3 月 7 日
回答済み: Harsh 2024 年 12 月 20 日
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?

回答 (1 件)

Harsh
Harsh 2024 年 12 月 20 日
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

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by