NARXNET closed-loop vs open-loop

6 次查看(过去 30 天)
I have three questions regarding the difference between a closed-loop and an open-loop narxnet, and it's behavior.
First, a little about the problem I'm trying to solve. I have an 2xN dimensional matrix of observation (X), from which I'm trying to predict an output Y, 1xN. Now, a narxnet takes as input both X and Y. The Matlab documentation says that an open-loop narxnet finds a function 'f' where y(t) = f( y(t-1), y(t-2), x(t-1), x(t-2) ), for a delay of 2. However, the results that I get are much more accurate than I expect them to be. This suggests that the narxnet uses the actual y(t) as input as well. When I convert the open-loop to a closed-loop, and retrain it, I get much more reasonable results, not good, but reasonable.
1.a) What is the actual input to an open-loop narxnet, and the closed-loop. When trying to predict y(t), are the inputs [ y(t), y(t-1), y(t-2), x(t-1), x(t-2) ] or [ y(t-1), y(t-2), x(t-1), x(t-2) ], for both?
1.b) For my problem I need the inputs to be [ y(t-1), y(t-2), x(t), x(t-1), x(t-2) ], 0 to 2 delays on the X, and 1 to 2 delays on the Y. How can I do that?
2. For comparison, I've trained my open-loop, and tested it, then convert the open-loop to a closed-loop using
netc = closeloop(net);
then trained the closed-loop from scratch and tested it. I've read on MATLAB Answers that I should start training the closed-loop with the weights from the open-loop net. How can I used the weights of one net as the initial weights for training another?
3. I understand that the narxnet uses a combination of NNs and difference equations. I problem I run into when using a closed-loop narxnet is that my predictions begin to oscillate and explode exponential. I know that this problem occurs in a difference equation, such as y(t)=a*y(t-1)+b, when 'a' is greater than 1. What, in a closed-loop narxnet could cause this similar issue?
I didn't include any code because my questions need high-level understanding and explanations, which I am lacking.
A huge thank you in advance,
- Yevgeniy

采纳的回答

Greg Heath
Greg Heath 2016-11-4
% NARXNET closed-loop vs open-loop
% Asked by Yevgeniy Arabadzhi
% 8:38 PM Thursday, November 3, 2016
%
% I have three questions regarding the difference between
% a closed-loop and an open-loop narxnet, and it's behavior.
%
% First, a little about the problem I'm trying to solve. I
% have an 2xN dimensional matrix of observation (X), from
% which I'm trying to predict an output Y, 1xN. Now, a
% narxnet takes as input both X and Y. The Matlab
% documentation says that an open-loop narxnet finds a
% function 'f' where y(t) = f( y(t-1), y(t-2), x(t-1),
% x(t-2) ), for a delay of 2.
What you are overlooking is the role of the target; In fact, you never mention the target!
The target is used to design and operate the OL net. To emphasize this point I prefer to use the following notation:
Uppercase for cells
Lowercase for doubles and integers
X,x for inputs
T,t for targets
Y,y for outputs
i,j for timestep indices
% However, the results that I % get are much more accurate than I expect them to be. % This suggests that the narxnet uses the actual y(t) % as input as well.
ABSOLUTELY NOT! You just happened to have an easy problem (which you did not identify!). There are a variety of sample datasets in the help and doc documentations. Use the commands
help nndatasets
doc nndatsets
% When I convert the open-loop to a closed-loop, and retrain it, % I get much more reasonable results, not good, but reasonable.
Typically, when you convert from OL to CL and compare the results over the length of the target, you will get a spectrum of results: from excellent to lousy. Again, this will be demonstated if you try some of the sample datasets.
I have posted tutorials on narxnet design. I gather from this post that you are not familiar with them.
% 1.a) What is the actual input to an open-loop narxnet, % and the closed-loop. When trying to predict y(t), are the % inputs [ y(t), y(t-1), y(t-2), x(t-1), x(t-2) ] or % [ y(t-1), y(t-2), x(t-1), x(t-2) ], for both?
ID = 1:2, FD = 1:2, H = 10 % DEFAULTs
OL: y(i) = f(x(i-1),x(i-2),t(i-1),t(i-2)); i = 3:N
CL: y(i) = f(x(i-1),x(i-2),y(i-1),y(i-2)); i = 3:N
ID = 0:2, FD = 0:2, H = 10
OL: y(i) = f(x(i),x(i-1),x(i-2),t(i),t(i-1),t(i-2)); i=3:N
CL: y(i) = f(x(i),x(i-1),x(i-2),y(i-1),y(i-2)); i = 3:N
NOTE THAT y(i) FEEDBACK IS NOT ALLOWED FOR CL !
% 1.b) For my problem I need the inputs to be [ y(t-1), % y(t-2), x(t), x(t-1), x(t-2) ], 0 to 2 delays on the X, % and 1 to 2 delays on the Y. How can I do that?
See above
% 2. For comparison, I've trained my open-loop, and tested % it, then convert the open-loop to a closed-loop using % netc = closeloop(net);
Next, compare the OL and CL on the OL design data.
% then trained the closed-loop from scratch and tested it. % I've read on MATLAB Answers that I should start training % the closed-loop with the weights from the open-loop net. % How can I used the weights of one net as the initial % weights for training another?
netc = closeloop(neto); netc = train(netc,X,Xoi,Aoi);
% 3. I understand that the narxnet uses a combination of % NNs and difference equations. I problem I run into when % using a closed-loop narxnet is that my predictions begin % to oscillate and explode exponential. I know that this % problem occurs in a difference equation, such as % y(t)=a*y(t-1)+b, when 'a' is greater than 1. What, in a % closed-loop narxnet could cause this similar issue?
Since the output containing errors is fed back to the input, the cause is, basically, similar.
% I didn't include any code because my questions need % high-level understanding and explanations, which I am % lacking. % % A huge thank you in advance, % % Yevgeniy
No, thank you. I'm sure more people than you realize will be thankful for this post.
Hope this helps
Greg
  2 个评论
Yevgeniy Arabadzhi
Yevgeniy Arabadzhi 2016-11-4
Greg,
Thanks for the detailed response. This answered my questions.
In my problem, I have 250 hours of accelerometer data. The accelerometer was attached to a hospital patient. I extract different features from this accelerometer, such as the number of movement made in an hour, or an average duration of movements in each hour. This is my X , a 250xN matrix, where N is the number of features I use. T, the targets, are the activity scores that a physician assigned to the patient for each hour, on scale 1-10. I want to build a model that can predict the activity score, without the physician. My goal is to use a set number of hours of data: the observations X, and targets T, to train the net, then I want to make predictions based only on the inputs X and the predictions(output) Y.
This is why I think the a very good result, like the one I get from the OL narxnet isn't realistic. Since human behavior is not consistent.
You've already cleared up alot for me, but do you have any last suggestions that might pertain to my problem.
Thank you very much,
Yevgeniy
Akash Menon
Akash Menon 2019-2-1
Thanks for the answer Greg! That clears up some questions I had too!

请先登录,再进行评论。

更多回答(1 个)

Greg Heath
Greg Heath 2016-11-4
编辑:Greg Heath 2016-11-4
Quick answer:
Openloop: Target and input signals are combined to form
a vector input for designing the net by estimating
weights and biases.
Closeloop: Target values are replaced by feedback
signals from the output so that the net is able to
predict outputs beyond the extent of the target signal.
Hope this helps.
Thank you for formally accepting my answer
Greg
  3 个评论
Ran Wei
Ran Wei 2019-2-12
Greg,
I have found your answers to many questions helpful for understanding NARX. Given a dataset X with dimension MxN, and response Y with dimension MX1, is it true that an open loop NARX predicts values based on past Y's? I am having a situation where the NARX net performance is almost equal to NAR. However, the performance of timedelay network is very bad with low precision and very low recall. The goal for me is to rely on X as predictors instead of Y.
Thank you,
Ran
Greg Heath
Greg Heath 2019-2-13
CLARIFICATION
TARGET = "DESIRED" OUTPUT
OLNARX : ONLY USED FOR DESIGN
OUTPUT DEPENDS ON INPUT + TARGET
CLNARX: USED FOR PREDICTION
OUTPUT DEPENDS ON INPUT + FEDBACKOUTPUT
Hope this helps
Greg

请先登录,再进行评论。

类别

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