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{:});

2 views (last 30 days)
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)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!