MATLAB Answers

Trying to use a previously trained NARX with a new set of external input. Error: Error using network/sim (line 266) Number of inputs does not match net.numInputs. Error in network/subsref (line 15) otherwise, v = sim(vin,subs{:});

5 views (last 30 days)
Jorge Pesantez
Jorge Pesantez on 27 Mar 2018
Commented: Unnati Thakkar on 14 Sep 2020
The problem seems to be recurrent because of all the similar questions I've read about it, and it's as follows:
I am training an ANN using 8 predictors and 1 vector as a target for a time series data with 5,000 time steps. The case is very similar (if not exactly to the MATLAB webinar of forecasting electricity in Australia). In that example, the fitting tool was applied to train the model and compared with Regression Trees. I did the same and the response was pretty good. The problem comes out when trying to apply NARX instead of either fitnet or feedforwardnet. Given a matrix train_x = [4000 x 8] to train my network (4,000 time steps 8 predictors), then I want to forecast data using a different set of predictors (a matrix test_x =[2000 x 8] using "net" function like this:
test = net(test_x')';
or similarly using sim function like this:
test = sim(net, train_x')'
Then, I got the following error:
"Error using network/sim (line 266) Number of inputs does not match net.numInputs."
But when testing after training the network using "fitnet" or "feedforwardnet", like this:
test = sim(net, train_x')';
I got the answer I was looking for.
What would be the cause of my error? Your feedback would be highly appreciated.
Sincerely, Jorge Pesantez

Answers (0)

Community Treasure Hunt

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

Start Hunting!