why the prediction of neural network is wrong?

1 次查看(过去 30 天)
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence 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