|
|
Re: how to train the network for stock data
Posted:
Dec 13, 2012 10:06 AM
|
|
"Murugan Solaiyappan" wrote in message <ka9akh$cvl$1@newscl01ah.mathworks.com>... > Dear Greg Sir, > > Thanks for your immediate reply, > With the help of your guidance I change my code, > % Loading Data > load ti_out_t.data; > P=ti_out_t(1:189,1:12); > T=ti_out_t(1:189,13:24); > a1=ti_out_t(190:271,1:12); > s1=ti_out_t(190:271,13:24); > % Normalising data > [pn,minp,maxp,tn,mint,maxt]=premnmx(P',T');
It is clearer if you transpose in the load statements and include a reminder in the comment
> [an1,mina1,maxa1,sn1,mins1,maxs1]=premnmx(a1',s1');
No.
a1 and s1 shold be normalized using the min amd max of P and T
However, you may want to compare the two sets of statistics to make sure that the net is applicable to a1,s1
> %network creation > net=newff(minmax(pn),[24 12],{'tansig','tansig'},'traingdm'); > net.trainParam.epochs=3000; > net.trainParam.lr=0.3; > net.trainParam.mc=0.6;
Why not use defaults?
Especially, why H = 24??
> % Train the network > net=train(net,pn,tn);
Why not compare tn and net(pn) ??
> y1=sim(net,an1)
Why not compare to sn1?
> % Un normalise the data > t1=postmnmx(y1',mins1,maxs1);
Transpose after, not in, postmnmx?
> [t1 s1] > plot(t1,'r') > hold; > plot(s); > title ('Comparision') > d=[t1-s].^2;
s1?
> [m b r]=postreg(t1',s1') > > When i executing the above code, displays the following error, > ??? Error using ==> times > Matrix dimensions must agree. > > Error in ==> postmnmx at 68 > p = p.*((maxp0-minp0)*oneQ) + minp0*oneQ; > > Error in ==> nn_taiwan_12input at 14 > t1=postmnmx(y1',mins1,maxs1); > > I can't understand the error. Please help me sir, > > the structure of ti_out_t.data (271Rows and 24 Columns (12 column for input and 12 column for output) > 1)0.00 0.00 0.00 0.00 0.00 0.00 0.07 1.00 0.93 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.28 1.00 0.72 0.00 0.00 0.00 > 2)0.00 0.00 0.00 0.00 0.00 0.00 0.28 1.00 0.72 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.77 1.00 0.23 0.00 0.00 0.00 0.00 > 3)0.00 0.00 0.00 0.00 0.00 0.77 1.00 0.23 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.42 1.00 0.58 0.00 > . > . > . > . > 271 > > I have problem with postprocessing work and also how can i predict the stock value for the new data.
Keep track of your dimensions and transpositions.
Hope this helps.
Greg
|
|