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

조회 수: 12 (최근 30일)
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

채택된 답변

Greg Heath
Greg Heath 2016년 2월 11일
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
Greg Heath
Greg Heath 2016년 2월 14일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Dennis
Dennis 2016년 2월 11일
편집: Dennis 2016년 2월 11일
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
Ghazi Binarandi
Ghazi Binarandi 2016년 2월 12일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by