why the prediction of neural network is wrong?

1 回表示 (過去 30 日間)
farfar
farfar 2018 年 7 月 24 日
編集済み: Greg Heath 2018 年 7 月 29 日
Hi
I have a matrix of input data (1X1006) and a 1X1006 target matrix. I trained the network and it gave me the regression line with R=0.98 and performance of 9.48E-10. I saved the trained network and used it for a new set of data to predict the target, but it gave me a negative number. I did not have any negative number in target when network was being trained. the new input is also a number completely in the range of my first input. I also need to mention that the range of input is between 0.002 to 7000 and the range of target is 0.00005 to 0.02. what is wrong ? Thanks
x=xlsread('input.xlsx');
t=xlsread('target.xlsx');
net = fitnet(10);
[net,tr] = train(net,x,t);
y=net(x);
nntraintool
farnet=net;
save farnet
testX = x(:,tr.testInd);
testT = t(:,tr.testInd);
testY = net(testX);
perf = mse(net,testT,testY)
figure
e = t - y;
ploterrhist(e)
hold on
figure
y = net(x);
plotregression(t,y)
load farnet
newinput=xlsread('newinput.xlsx');
newoutput = farnet(newinput)

採用された回答

Greg Heath
Greg Heath 2018 年 7 月 26 日
1.There is nothing in your design to prevent negative outputs.
2. Therefore the question is
What are the ranks of the ABSOLUTE VALUES of the negative
output errors?
3. If this still bothers you, use a nonnegative output function.
Hope this helps.
Thank you for formally accepting my answer
Greg
  2 件のコメント
farfar
farfar 2018 年 7 月 26 日
編集済み: farfar 2018 年 7 月 26 日
Thank you. No i did not define a function to prevent negative output. but should not the output be based on 1000 targets that I trained the network with ? why the network cant predict the output as positive value like all the target ? so you are saying if the output is -0.00023, I can just assume it is 0.00023?
how can I define a nonnegative output function? Thank you
Greg Heath
Greg Heath 2018 年 7 月 29 日
編集済み: Greg Heath 2018 年 7 月 29 日
Have ever heard of a sigmoid ?
G

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by