Time shift between target and simulation output using a neural network

I am currently working with neural networks, and I'm still a beginner. My goal is to use MLP for time series prediction (I know that NARX networks may be more suitable for time series predictions, but this is an MLP requirement).

For example, I want to predict a stream Q(t+x)with current and historical stream Q(t...t-n)and precipitation P(t...t-m), etc.

The results of my network trainings (training, testing and network testing) and the additional period of testing show relatively good qualities (correlation and RMSE). But when I look closer to the exit of the training and validation period, there is a lag behind the goals of the corresponding period. And my problem is that I don’t know why.

The delay exactly matches my x prediction, no matter how big x is.

I use the standard MLP from the Matlab toolkit with the default settings (random separation, trainlm, etc.), for example, using the graphical NN tool (but I also tested other settings with my own code).

With a simple Q(t)NAR network, this is the same problem. If I try it with regular data, for example, to predict sin(t+x)using sin(t..t-n)or with a rectangular function, there is no time shift, everything is fine.

( ) , [0.12 0.14 0.13 0.1 0.1 0.1 ... (n ) 0.1 ... 0.1 0.1 0.14 0.15 0.12 ...], . Q(t+x), Q(t). . 7 . .

-, -, . , , ? , , matlab , . , ( rmse ).

matlab 2012.

, . .

%% minimalstic example
% but there is the same problem with more input variables

load Q

%% create net inputs and targets

% start point of t
t = 100; 

% history data of Q -> Q(t-1), Q(t-2), Q(t-3)
inputs = [Q(t-1:end-1,1) Q(t-2:end-2,1) Q(t-3:end-3,1)]';

% timestep t that want to be predicted
targets = Q(t:end,1)';

%% create fitting net (MLP) 
% but it is the same problem for NARnet
% and from here, you can also use the NN graphical tool

% number of hidden neurons
numHiddenNeurons = 6;  % the described problem is not dependent on this 
                       % point, therefor it is freely chosen

net = fitnet(numHiddenNeurons); % same problem if choosing the old version newfit

% default MLP settings, no changes, but the problem even exist with other
% combinations of settings

% train net
[trained_net,tr] = train(net,inputs,targets);

% apply trained net with given data (create net outputs)
outputs = sim(trained_net,inputs);

figure(1)
hold on
bar(targets',0.6,'FaceColor','r','EdgeColor','none')
bar(outputs',0.2,'FaceColor','b','EdgeColor','none')
legend('observation','prediction')
% please zoom very far to see single bars!! the bar plot shows very good
% the time shift
% if you choose a bigger forecasting time, the shift will also be better to
% see

%% the result: targets(1,1)=Q(t), outputs(1,1)=Q(t-1)

%% now try the sinus function, the problem will not be there

x = 1:1:1152;
SIN = sin(x);

inputs = [SIN(1,t-1:end-1);SIN(1,t-2:end-2);SIN(1,t-3:end-3)];
targets = SIN(1,t:end);

% start again from above, creating the net

.

+4
2

, , . Diphtong, , ( ).

. , , -1.0 +1.0. , , /, , .

, . , , . , , 0.

, :

  • : [t-1], [t-2],..., [t-w]
  • : [t]
+1

" ", , , @Diphtong: , " " (), ( ) .

, , LOG() SQRT(), ...

0

All Articles