Borrar filtros
Borrar filtros

I cannot get closed loop network to run.

1 visualización (últimos 30 días)
Kevin Johnson
Kevin Johnson el 29 de Nov. de 2021
Comentada: Kevin Johnson el 29 de Nov. de 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 comentarios
Walter Roberson
Walter Roberson el 29 de Nov. de 2021
But what is size(xf) and size(xi) ?
Hypothethically, the closeloop() might have changed the number of inputs required.
Kevin Johnson
Kevin Johnson el 29 de Nov. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by