Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: how to train the network for stock data
Replies: 3   Last Post: Dec 13, 2012 10:06 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Greg Heath

Posts: 5,975
Registered: 12/7/04
Re: how to train the network for stock data
Posted: Dec 13, 2012 10:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.