Timedelaynet output calculation principle

3 ビュー (過去 30 日間)
Tingting Zhang
Tingting Zhang 2019 年 9 月 8 日
コメント済み: Tingting Zhang 2019 年 9 月 10 日
I have built a focused time-delay NN (two delays, 2 layers, hidden layer size of 2) and changed all the inputweights and layerweights to be zero (no bias is used). I would expect all zero output, but why the code give me nonzero values. Is there anybody can give suggestions on what's wrong? The simple code is shown as following:
clear;
numtaps = 2;
hiddenLayerSize = 2;
dyn_net = timedelaynet(1:numtaps,hiddenLayerSize);
dyn_net.trainFcn = 'trainlm';
dyn_net.layers{1}.transferFcn = 'tansig';
dyn_net.initFcn = 'initlay';
dyn_net.performFcn = 'mse';
dyn_net.biasConnect = [0;0];
dyn_net.trainParam.epochs = 1;
inputs = 0:0.1:1;
targets= 0:0.1:1;
inputs_1c = num2cell(inputs,1);
targets_1c = num2cell(targets,1);
[p,Pi,Ai,t] = preparets(dyn_net,inputs_1c,targets_1c);
[dyn_net,dyn_tr] = train(dyn_net,p,t,Pi,Ai);
dyn_net.IW{1,1} =[0 0;0 0];
dyn_net.LW{2,1} =[0 0];
output = dyn_net(p,Pi);
outputs1 = cell2mat(output); % I should expect zero, but the outputs are all 0.6.
dyn_net.LW{2,1}*tansig(dyn_net.IW{1,1}*(inputs(6:7)).') % This calculation gives me zero

回答 (1 件)

Greg Heath
Greg Heath 2019 年 9 月 9 日
You did not include tHe 2 biases.
Hope this helps.
Greg
THANK YOU FOR FORMALLY ACCEPTING MY ANSWER
  1 件のコメント
Tingting Zhang
Tingting Zhang 2019 年 9 月 10 日
Hi Greg,
Thanks for your answer. The configure of the NN is shown as following.Capture.JPG
I intend not to include the bias just want to check the feedforward output calculation. I would expect that to be:
dyn_net.LW{2,1}*tansig(dyn_net.IW{1,1}*(inputs(k-1:-1:k-2)).').
But it is not the same as what I expect. So I manually change the inputweights and layerweights to be zero after training (before training gives me an error), and found nonzero output, that's weird.
I have also tried to include the bias as you suggested, the problem is still there.

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by