FeedForwardNet's Algorithms

I have a trained feedforward network with 2 hidden layers, and now I want to implement that network on my webpage on which users can input some value and get corresponding answers calculate by the neural network. To do that, I am thinking of a javascript. And I wrote a code in matlab to test the algorithms.
The problem is that the answer calculated directly by the network is totally different from the answer by my code. Would someone tell me where did I go wrong? Or is there an easier way to do that on my webpage?
load(['../result/' savename], 'nnet', 'ntr');
iw = nnet.iw{1,1};
lw1 = nnet.lw{2,1};
lw2 = nnet.lw{3,2};
b1 = nnet.b{1};
b2 = nnet.b{2};
b3 = nnet.b{3};
ymin = nnet.inputs{1,1}.processedRange(:,1);
ymax = nnet.inputs{1,1}.processedRange(:,2);
xmin = nnet.inputs{1,1}.range(:,1);
xmax = nnet.inputs{1,1}.range(:,2);
inp = [1;2;3;4];
inp = (ymax-ymin).*(inp-xmin)./(xmax-xmin) + ymin;
a = tansig(dotprod(iw,inp)+b1);
b = tansig(dotprod(lw1,a)+b2);
c = purelin(dotprod(lw2,b)+b3);
ymin = nnet.outputs{3}.processedRange(:,1);
ymax = nnet.outputs{3}.processedRange(:,2);
xmin = nnet.outputs{3}.range(:,1);
xmax = nnet.outputs{3}.range(:,2);
c = (xmax-xmin).*(c-ymin)./(ymax-ymin) + xmin;
c1 = nnet(inp);

답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2011년 7월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by