Filter löschen
Filter löschen

I cannot get closed loop network to run.

1 Ansicht (letzte 30 Tage)
Kevin Johnson
Kevin Johnson am 29 Nov. 2021
Kommentiert: Kevin Johnson am 29 Nov. 2021
%first, I prepare the open network in the usual way
net=narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
% Prepare Data
X = tonndata(inputs,false,false);
T = tonndata(target,false,false);
[x,xi,ai,t] = preparets(net,X,{},T);
% Train on first half of data
% r is the length of the data
% 2 represents the delays
hw=floor(r/2);
x_firsthalf=x(:,1:hw-2);
t_firsthalf=t(1:hw-2);
net = train(net,x_firsthalf,t_firsthalf,xi,ai);
% Get the (in-sample) open loop results on the first half of the data
[yopen,xf,af] = net(x_firsthalf,xi,ai);
% These results are good, as expected.
% Convert to closed loop network
[netc,xi,ai]=closeloop(net,xf,af);
% Get the closed loop results on the second half of the data
x_secondhalf=x(:,hw-2+1:end);
[yclosed,xf,af] = netc(x_secondhalf,xi,ai);
% Returns error message: "Error using network/sim (line 270)
% Number of inputs does not match net.numInputs."
% Yet x_firsthalf and x_secondhalf have the same numbers of input columns.
% What am I overlooking?
  2 Kommentare
Walter Roberson
Walter Roberson am 29 Nov. 2021
But what is size(xf) and size(xi) ?
Hypothethically, the closeloop() might have changed the number of inputs required.
Kevin Johnson
Kevin Johnson am 29 Nov. 2021
In [netc,xi,ai]=closeloop(net,xf,af), size of xf is 2x2, and size of xi is 1 x 2. The target column was dropped by closeloop. When I remove it before using netc, netc executes (though the closed loop results are very poor unfortunately!). Thanks for your help.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by