From: Tobias Dehler on 14 Apr 2010 05:57 Hi Chandler, I have exactly the same problem you describe below. How have you solved it? Thank you Tobias "Chandler " <blutzed44(a)yahoo.com> wrote in message <hh89vg$3ik$1(a)fred.mathworks.com>... > Hi all, > > I'm trying to set up a Narx network but would like different lags for the exogeneous and dependent variable. The application in the user's guide for the neural network toolbox clearly explains how to handle the situation where the lags for the exogenous variable and the dependent variable are the same: > > http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/dynamic5.html > > In my code I have a dependent variable x and an exogenous variable y which are vectors of equal length at the beginning of the code. I want to set up a Narx network where the dependent variable and exogeneous variable have different delays. My understanding from the user's guide is that the input vector, p, and the target vector, t, will be of different lengths if the input and output delay is different. Even if the newnarxsp function accepts different lengths for p and t, I run into problems when trying to create the Pi matrix as the initial values for x and y will have different lengths. The same issue arises when I try to create the input vector to use in the train function. Is there a workaround here? Can I try padding the shorter vector with NaN values or zeros? > > Thank you so much for your help and I really appreciate it, > Chandler > > > > %Prepare the vectors so they are between zero and 1 > [x,xs] = mapminmax(x); > [y,ys] = mapminmax(y); > > %Convert the series from concurrent vectors to sequences > x = con2seq(x); > y = con2seq(y); > > % for example, j = 1 and i = 2 > > %The input delay vector -- for lags of the y > d1 = [1:j]; > %The output delay vector -- for lags of x > d2 = [1:i]; > > t = x(i+1:end); > p = y(j+1:end); > > narx_net = newnarxsp(p,t,d1,d2,hidden); > > %the bayesian regulation training function > narx_net.trainFcn = 'trainbr'; > narx_net.trainParam.show = 10; > narx_net.trainParam.epochs = 500; > > Pi = [y(1:j); x(1:i)]; > narx_net = train(narx_net,[p;t],t,Pi);
|
Pages: 1 Prev: FFT and small prime factors Next: Use Model Info in Libraries |