How can I train multiple sequences in neural network using feedforwardnet?

12 visualizzazioni (ultimi 30 giorni)
Hello,
I have 5 pairs (input-output) of time series. I know the way to train multiple time series using a dynamic neural network ( http://www.mathworks.com/help/nnet/ug/multiple-sequences-with-dynamic-neural-networks.html ), however I'd like to use a static neural network (feedforwardnet function) instead. How could I do that?
Thanks,
Ghazi

Risposta accettata

Greg Heath
Greg Heath il 11 Feb 2016
close all, clear all, clc
[ X0 T0 ] = simplenarx_dataset;
X(1,:) = X0(1:end-2); X(2,:) = X0(2:end-1);
X(3,:) = T0(1:end-2); X(4,:) = T0(2:end-1);
T = T0(3:end);
x= cell2mat(X); t = cell2mat(T);
vart = var(t,1)
net = feedforwardnet;
for i =1:10
net = configure(net, x, t);
[ net tr y e ] = train(net,x,t);
NMSE(i,1) = mse(e)/vart;
end
NMSE = NMSE
For your 5 series problem with 4 default 1:2 input and feedback delays,
size(X,1) = 5*4 = 20 and size(T,1) = 5*1 = 5
Hope this helps.
Thank you for formally accepting my answer
Greg
  5 Commenti
Greg Heath
Greg Heath il 14 Feb 2016
I do retrain the net 9 times. HOWEVER, in order to get 10 INDEPENDENT designs, I need to use CONFIGURE to reinintialize BOTH the random trn/val/tst data division AND the random weight initialization.
You can keep the current best net through the loop, or save the current RNG state corresponding to the best net for a later redesign.
In general, I use a double loop approach with the outer loop to determine the smallest value of number of hidden nodes, H that will yield the desired goal.
Search both NEWSGROUP and ANSWERS using
for h = Hmin:dH:Hmax

Accedi per commentare.

Più risposte (1)

Dennis
Dennis il 11 Feb 2016
Modificato: Dennis il 11 Feb 2016
Do you mean the "input output and curve fitting" neural network type from nnstart? Since in that network, no delayed information about previous inputs/outputs is used, you can simply add all your datasets in one big matrix:
Example input u and output y (where 1 and 2 are two seperately measured datasets):
u1 = [1 2 3 4 5] y1 = [1 1 1 2 1]
u2 = [2 2 3 2 3] y2 = [3 3 3 4 3]
X = [u1 u2] T = [y1 y2]
and train the nn with input X and output T. Be aware that you still need to convert these matrices to a nn dataset with tonndata(). Watch the dimensions of your data, e.g. if it is a vertical vector instead of the shown horizontal vector. If you are not familiar with the training commands, type in nnstart and let the tool help you.
However, if you want to use a nn as mathematical model for a dynamic system (engineering background, machinery, some electrical filter), then you must use the dynamic ones from the nnstart toolbox "dynamic time series". Since this kind of nn reacts to past events, multiple datasets for training cannot be simply put together - it would look like your physical system would "jump" every time a new dataset it coming. Instead, for dynamic nn you must use catsample to make the training algorithm acknowledge that there are multiple, separated datasets. You can see the effect of catsample in the following screenshot:
  1 Commento
Ghazi Binarandi
Ghazi Binarandi il 12 Feb 2016
I am intending to train a multiple time series using a feedforward neural network. I couldn't put them together into a single big matrix because it is consisted of several separate sequences.

Accedi per commentare.

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by