How can I train multiple sequences in neural network using feedforwardnet?
3 次查看(过去 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
0 个评论
采纳的回答
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
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
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172772/image.png)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!