Prepare input and target time series data for network simulation or training
[Xs,Xi,Ai,Ts,EWs,shift] = preparets(net,Xnf,Tnf,Tf,EW)
This function simplifies the normally complex and error prone task of reformatting input and target time series. It automatically shifts input and target time series as many steps as are needed to fill the initial input and layer delay states. If the network has open-loop feedback, then it copies feedback targets into the inputs as needed to define the open-loop inputs.
Each time a new network is designed, with different numbers of delays or feedback settings,
preparets
can reformat input and target data accordingly. Also, each time a network
is transformed with openloop
, closeloop
, removedelay
or adddelay
, this function can reformat the data accordingly.
[Xs,Xi,Ai,Ts,EWs,shift] = preparets(net,Xnf,Tnf,Tf,EW)
takes these
arguments,
net | Neural network |
Xnf | Non-feedback inputs |
Tnf | Non-feedback targets |
Tf | Feedback targets |
EW | Error weights (default = |
and returns,
Xs | Shifted inputs |
Xi | Initial input delay states |
Ai | Initial layer delay states |
Ts | Shifted targets |
EWs | Shifted error weights |
shift | The number of timesteps truncated from the front of |
Here a time-delay network with 20 hidden neurons is created, trained and simulated.
[X,T] = simpleseries_dataset; net = timedelaynet(1:2,20); [Xs,Xi,Ai,Ts] = preparets(net,X,T); net = train(net,Xs,Ts); view(net) Y = net(Xs,Xi,Ai);
Here a NARX network is designed. The NARX network has a standard input and an open-loop feedback output to an associated feedback input.
[X,T] = simplenarx_dataset; net = narxnet(1:2,1:2,20); [Xs,Xi,Ai,Ts] = preparets(net,X,{},T); net = train(net,Xs,Ts,Xi,Ai); view(net) y = net(Xs,Xi,Ai);
Now the network is converted to closed loop, and the data is reformatted to simulate the network’s closed-loop response.
net = closeloop(net); view(net) [Xs,Xi,Ai] = preparets(net,X,{},T); y = net(Xs,Xi,Ai);
adddelay
| closeloop
| narnet
| narxnet
| openloop
| removedelay
| timedelaynet