- The quality of xi1 directly affects prediction accuracy. You should use actual historical values for the first prediction, then update with predicted values.
- If your network was trained in open-loop mode, consider converting it to closed-loop using closeloop(net) before exporting. This allows it to use its own predictions as future inputs.
Getting output values from Neural net time series for energy price prediction
3 views (last 30 days)
Show older comments
I am currently using Matlab Neural net time series to predict future values of energy prices for school work.
I have simply x and y values.
X values are actually dates, which I have transformed into numeric values by simply assigning 1 for the first date data. So they go as 1,2,3,... from 1 to 48.
Dependent y values are numeric energy price values such as 7,10,15, etc.
I am using Nonlinear input-output network for my analysis.
After I export model as Network Function to MATLAB Coder, I believe I should be using
[y1,xf1] = myNeuralNetworkFunction(x1,xi1)
to get outputs from trained network.
I have 48 data, and I want to use trained network to predict 49,50,...68 data until 68th.
How am I supposed to continue?
When I input [49] for the x1 value to get prediction of 49th value, I realized that input of xi1 (delay input) affects the output significantly. What should I write to xi1 to get a good result?
0 Comments
Answers (1)
Ayush Aniket
on 3 Sep 2025
Since you are using a Nonlinear Input-Output Time Series Network, the xi1 input is crucial for accurate forecasting beyond your training data. Here’s how to proceed:
1. Understand xi1 (Delayed Input States) - The network uses past input values to predict future outputs. xi1 holds the delay history, typically the last d values of your input series, where d is the number of delays used during training.
If your network was trained with, say, 2 delays, then to predict the 49th value, you need:
x1 = {49}; % Current input
xi1 = {[47 48]}; % Delayed inputs (from training data)
These delayed values help the network maintain context.
2. Predict Multiple Future Steps - To predict values from 49 to 68, you need to simulate forward iteratively, updating xi1 with each new prediction:
% Initialize with last known inputs
xi = {[46 47 48]}; % Example for 3 delays
for t = 49:68
x1 = {t}; % Current time step
[y1, xf1] = myNeuralNetworkFunction(x1, xi);
% Store prediction
predictions(t) = y1{1};
% Update xi for next step
xi = [xi{1}(2:end), x1]; % Shift and append new input
xi = {xi}; % Wrap in cell
end
This loop feeds each new prediction back into the delay line, simulating the network forward.
Points to note:
0 Comments
See Also
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!