Problem getting adapt to work with my existing NARXNET: “Number of inputs does not match net.numInputs”

12 visualizaciones (últimos 30 días)
I have a narxnet batch trained on historical data that I now want to implement in an “online situation” where I continuously feed new inputs and targets to it as they are generated and have the net adapt to the new data.
As far as I understand this is exactly what the adapt function is supposed to do but I’m not getting it to accept the new data I’m giving it. Before I use adapt I have a narxnet (called net) with 9 hidden nodes at 1:39 feedback delays and 1:39 input delays, and then I want to present the next input/targets by typing:
X=X2(1:1); %This is a cell containing 13x1 external inputs for one timestep
T=T2(1:1); % This is a cell containing 1x1 targets for the same timestep
[net,y,e,pf] = adapt(net,X,T); %Feed the existing net + inputs + targets to the adapt function.
But all I get when trying this is:
Error using network/adapt (line 92)
Number of inputs does not match net.numInputs.
If I type “net.numInputs” matlab returns the number 2. So I don’t understand what the problem here is, what does that even mean and why does it want 2 inputs? Isn’t the whole point of incremental training that I should be able to present the new data one at the time to the net?
I would really appreciate any advice on what I’m doing wrong here, I’ve searched for hours but the examples and documentation regarding how to implement adapt seems to be very limited...
Thanks.

Respuesta aceptada

Greg Heath
Greg Heath el 28 de Jun. de 2015
Editada: Greg Heath el 28 de Jun. de 2015
If you have a trained net (e.g., narxnet(ID,FD,H) ) with maxlag = max(ID,FD), you cannot get a result for a new sequence that is shorter than maxlag+1. PREPARETS should yield a dimension error.
An openloop narxnet has 2 inputs: One for the input and one for the target feedback.
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 comentario
Peta
Peta el 28 de Jun. de 2015
Editada: Peta el 28 de Jun. de 2015
Yes I’ve noticed that, the question is how to correctly present the new inputs one at a time as they arrive to the net.
If I keep a short term buffer in an online situation of the latest arriving streaming values of history length maxlag and constantly shift them so that the buffer always contains a history window the most up to date values I could give preparenets the targets and external inputs that contains the last 20 values or so (depending on what ID and FD I have) and then put the very latest value that I want to present to the net at the beginning of that. Then the sequence would be of length maxlag+1 and the functions would not object.
But since I haven’t been able to find any guides or answered questions regarding any similar topic I’m just not sure if that’s how to do it or if it would result in some sort of faulty training since every value is being presented several times to the net?

Iniciar sesión para comentar.

Más respuestas (1)

Greg Heath
Greg Heath el 22 de Jun. de 2015
You have to use preparets to determine the syntax of the input, target, input delay and feedback delay. Those are the inputs to train.
Greg
  1 comentario
Peta
Peta el 22 de Jun. de 2015
I’ve tried that but it’s also giving me an error:
[Xs,Xi,Ai,Ts] = preparets(net,X,{},T)
Index exceeds matrix dimensions.
Error in preparets (line 293)
xi = xx(:,FBS+((1-net.numInputDelays):0));
I don’t fully understand what the error is trying to say but I suspect that it’s caused by the fact that I’m only giving it one time step and preparenet tries to shift the inputs according to my input/feedback delays which are greater than one. And if that is the case I’m not sure how to get around it.

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by