Error Message when using configured ANN (mismatch number of inputs)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Léon
am 16 Sep. 2011
Beantwortet: Tyler Roman
am 11 Jan. 2016
After creating and storing an ANN in Matlab (ANN Toolbox V 7.0) I tried to compute new predictions using a new set of input observations with:
net(new_obs)
the old Input Matrix was 1511x145, the new one is 100x145, observations are in rows each time. But the error message I get is now:
??? Error using ==> network.sim at 121
Number of inputs does not match net.numInputs.
Error in ==> network.subsref at 14
[v,out2,out3] = sim(vin,subs{:});
In fact, the origin Input matrix does not work with this code either!
I'm wondering if this error corresponds to the type of ANN I'm using since this one is a NARX. But I created a different ANN for a completely different purpose (Pattern Recognition with binary outcome) and there it works at a glance. :-/
Help is greatly appreciated!
0 Kommentare
Akzeptierte Antwort
Lucas García
am 16 Sep. 2011
The functions for creating networks in the toolbox will assume that if your input matrix is n x m it will represent m samples of n elements each.
You should present your data to the network as a transposed matrix 145x1511 of your current input matrix when you train the network. The same when you present new inputs to the network, 145x100.
Update
In order to present your input to the network, you can use tonndata in convert your matrix to the standard cell array form. After doing that, the output from tonndata which will be the input to your network, should look like:
[145x1 double] [145x1 double] ... [145x1 double]
1511 times
You should do the same for your targets. Then you can use preparets and train to complete the training process. Once that is done, you should be able to simulate the network, convert to closeloop in order to perform a multi-step-ahead prediction, etc. Notice that you will have to use tonndata again to present new inputs for the simulation process.
0 Kommentare
Weitere Antworten (6)
Tyler Roman
am 11 Jan. 2016
I came across this thread and believe I'm having a very similar issue. I've been able to get an idea of where the problem lies, but it would be helpful to see a full set of code if someone could provide it (The link posted above is no longer valid). I basically have trained a ANN in hopes of using it to fill in some missing data from a time series. I'm able to train it fine but am having trouble getting output when running it on new input data (matrix with 6 columns) to get a single output.
0 Kommentare
Léon
am 16 Sep. 2011
1 Kommentar
Lucas García
am 16 Sep. 2011
Can you provide some more info of the architecture of your network? Some code will be helpful to try to understand the problem.
Léon
am 17 Sep. 2011
1 Kommentar
Lucas García
am 19 Sep. 2011
Hi Léon,
Can't see your code in the link you provided. However, I think it's a matter of how inputs are being presented to the network. I have updated my previous answer trying to be a little more clear.
Léon
am 21 Sep. 2011
1 Kommentar
Lucas García
am 21 Sep. 2011
Hi Léon,
I have been able to access your link and execute your code. And it works fine. I have tried both in MATLAB R2011b and R2010b (which is the one I think you are using).
1. Make sure you clear all your variables before executing your code.
2. Have you changed any MATLAB files in the toolbox? If you have, you probably need to reinstall the toolbox.
Léon
am 22 Sep. 2011
1 Kommentar
Lucas García
am 22 Sep. 2011
I use narxnet for creating the network and then use the net object to do the simulation. Exactly the same that you do for a simple pattern neural network.
Try to execute the code in this link:
http://www.mathworks.es/matlabcentral/answers/14970-neural-network-multi-step-ahead-prediction
The data is available in the toolbox, so you should be able to execute it straight away. Let me know if it works.
If it doesn't then you will have to debug the sim function to try to identify the source of the problem.
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!