MATLAB: How to format the data properly to use NARX

narxNetworkneuraltraining

How do I format my data properly to use NARX? Specifically, I would like to train a NARX network through the Neural Network Trainer Application in MATLAB.

Best Answer

  • If you are attempting to build a neural network, like the NARX time series predictor, then the format of the data needs to be a 1xn cell vector. This is for both the input time series and the target time series. "n" is the number of time steps you have (it can be different between the input time series and the target time series). Each entry in the cell array is a matrix where the rows of the matrix represent the different time series you have, and the columns represent the number of variables you observe at that time step for each separate time series.
    NARX networks use an "external" time series to help predict the time series that you are interested in, such as using Microsoft stock to help predict Apple stock. You can have several inputs, such as also using Intel stock. Thus, your input time series would be a 1x n cell array, with each entry being a 2x1 matrix, representing the value of the Microsoft and Intel Stocks at that time step. If you wanted to include more variables, such as also the number of employees at Microsoft and Intel at each time step, then each entry in the cell array would be a 2x2 matrix. The first row of the matrix would represent the stock of Microsoft and the number of employees at Microsoft and the second row would be the same but for Intel. This would all be for a particular time step.