MATLAB Answers

Forecasting by Neural Network

11 views (last 30 days)
Hello everyone ! I am entirely new to the "Neural Network Toolbox". However I have explored many example data sets provided in NN toolbox , but i am having trouble in fitting my own case study into it . i am frustrated and completely drained out after following many webinars and searching here. Your help will be highly appreciated . My problem is as follows .
I have the data set which contains monthly demand of 30 vehicle models of a heavy commercial automobile manufacturer for the past 3 years. In short , my datasheet is of size [ 30 X 36 ] , ( 30 vehicle models are represented row wise) .
I want to forecast the future demand of all vehicles by using Neural Network . I have tried using Curve Fitting , Time series (both NAR and NARX) by the default setting and various training algorithms , But still the MSE is not acceptable . Is it just because of my "SMALL data set" ? or anything else ?
Kindly suggest me some method (or some way ) , So that i can work with the same dataset and predict the future values by using Neural Network .
Your coperation will be higly praised . Thank You all in advance ( Please ignore my bad english)
  10 Comments
pradeep kumar
pradeep kumar on 7 Feb 2015
@ Greg Heath , Respected Sir . As per your instructions i have tried to rectify the network , and the values are as follows .
MSE00 = var(cell2mat(t)) % since my inputs are taken row wise it should not be MSE00 = var(cell2mat(t,1)) .
MSE00 =
1.0021
>> performance
performance =
0.0084
>> nperf = performance/MSE00
nperf =
0.0084
>> ntrnperf = tr.best_perf/MSE00
ntrnperf =
0.0059
>> ntstperf = tr.best_tperf/MSE00
ntstperf =
0.0200
>> nperfc = perfc/MSE00
nperfc =
1.6429
>> NMSE = mse(e)/MSE00
NMSE =
0.0084
I think these values are now upto your expectations . now please tell me how am i able to PREDICT(FORECAST) the next values which are not included in my histrical database . Thanks in advance and have a nice weekend . -Pradeep

Sign in to comment.

Accepted Answer

Greg Heath
Greg Heath on 15 Feb 2015
It is straightforward. The basic logic is
0. Standardize T using cell2mat and zscore
1. Minimize H subject to NMSEo <= 0.005
neto = narnet(FD,H);
[ Xo Xoi Aoi To ] = preparets( neto,{},{}, T );
neto = configure( neto, Xoi, Aoi);
[ neto Yo Eo Xof Aof ] = train( neto, Xo, To, Xoi, Aoi );
% [ Yo Xof Aof ] = net( Xo, Xoi ,Aoi );
% Eo = gsubtract(To,Yo);
NMSEo = mse(Eo)/mean(var(cell2mat(To}',1))
2. Close the loop on OL neto to obtain CL netc
[ netc Xci Aci ] = closeloop( neto, Xoi, Aoi );
[ Xc Xci Aci Tc ]= preparets( netc,{},{}, T );
[ Yc Xcf Acf ] = netc( Xc, Xci ,Aci );
Ec = gsubtract(Tc,Yc);
NMSEc = mse(Ec)/mean(var(cell2mat(Tc}',1))
3. If NMSEc is not sufficiently small (<= 0.01, 0.05 ???) then train netc initialized with the final weights of neto
[ netc Yc Ec Xcf Acf ] = train( netc, Xc, Tc, Xci, Aci );
% [ Yc Xcf Acf ] = netc( Xc, Xci ,Aci );
% Ec = gsubtract(Tc,Yc);
NMSEc = mse(Ec)/mean(var(cell2mat(Tc}',1))
4. Predict performance Np steps beyond the currently known data
[ Yc2 Xcf2 Acf2 ] = netc( cell(1,Np), Xcf ,Acf );
Hope this helps.
Thank you for formally accepting my answer
Greg
PS I'm sure this is covered in one of my previous posts in the NEWSGROUP or ANSWERS. Search using
greg narnet closeloop
  2 Comments
pradeep kumar
pradeep kumar on 19 Feb 2015
@ Greg Heath , Respected Sir , apart from the above i am getting the following error at the final step . point 4 .Predict performance Np steps beyond the currently known data .
[ Yc2 Xcf2 Acf2 ] = netc( cell(1,Np), Xcf ,Acf );
Error using network/sim (line 267)
Number of input states does not match net.numInputs.
Error in network/subsref (line 14)
case 3, [v,out2,out3] = sim(vin,subs{:});
I want to forecast (predict ) the future value from the modeled Network . Please do me a last favour . Thank You.

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 14 Feb 2015
MSE00 = mean(var(cell2mat(T)',1)) % For T cell
MSE00 = mean(var(t',1)) % For t double, series are rows
nperfc is unsatisfactory.
Try training CL netc using the original data but initialized by the final weights of OL neto
If unsatisfactory, design another OL neto. Designing a CL netc from scratch will take too much time AND it will not be guaranteed to be a satisfactory design because the initial weights are random.
Hope this helps.
Greg
  1 Comment
pradeep kumar
pradeep kumar on 14 Feb 2015
@ GReg : how to try training CL netc using the original data but initialized by the final weights of OL neto ? please help me . thankx

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!