ANN Using the Matlab, code.
2 views (last 30 days)
Show older comments
During, i used the neural network. I have some porblem. I know that preprocessing was mapminmax in Matlab(R2010b). But, I don't know command of postprocessing.
Let me know , please. And, Could you check of my code?
Thack you for reading.
>>P=[1:2247,1:6]; %input
>>T=[1:2247,7:8]; %target
>>a=[2188:2247,1:6]; %test input
>>s=[2188:2247,7:8]; %test target
>>[pn1,PS] = mapminmax(P);
>>[tn1,TS] = mapminmax(T);
>>[an1,AS] = mapminmax(a);
>>[sn1,SS] = mapminmax(s);
>>[pn1,tn1] = simplefit_dataset;
>>[an1,sn1] = simplefit_dataset;
>>net = feedforwardnet([8 4]);
>>[net,TR]=train(net,pn1,tn1)
>>y2=sim(net,an1);
>>y2_again = mapminmax('reverse',y2',TS);
>>plot(y2_again,'r')
>>hold
>>plot(s)
>>d=(y2_again-s).^2
>>mse1=mean(d)
0 Comments
Answers (1)
Greg Heath
on 27 Mar 2012
>>P=[1:2247,1:6]; %input
>>T=[1:2247,7:8]; %target
These are indices, not data matrices.
They are transposed. They should have the same number of rows.
>>a=[2188:2247,1:6]; %test input
>>s=[2188:2247,7:8]; %test target
Data division is done automatically see the documentation and demos
>>[pn1,PS] = mapminmax(P);
>>[tn1,TS] = mapminmax(T);
>>[an1,AS] = mapminmax(a);
>>[sn1,SS] = mapminmax(s);
Normalization is done automatically see the documentation and demos.
a and s must be normalized by the max and min of P and T
>>[pn1,tn1] = simplefit_dataset;
>>[an1,sn1] = simplefit_dataset;
They should not be the same data
>>net = feedforwardnet([8 4]);
One hidden layer is sufficient.
>>[net,TR]=train(net,pn1,tn1)
>>y2=sim(net,an1);
>>y2_again = mapminmax('reverse',y2',TS);
>>plot(y2_again,'r')
>>hold
>>plot(s)>>d=(y2_again-s).^2 >>mse1=mean(d)
Incorrect calculation of mse. Compare results with output of function mse.
Please go back to the documentation and demos before rewriting.
Make sure the code you post will run when cut and pasted into the command line.
Hope this helps.
Greg
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!