Effacer les filtres
Effacer les filtres

I cannot get closed loop network to run.

1 vue (au cours des 30 derniers jours)
Kevin Johnson
Kevin Johnson le 29 Nov 2021
Commenté : Kevin Johnson le 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 commentaires
Walter Roberson
Walter Roberson le 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 le 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by