neuralforecast
neuralforecast copied to clipboard
"sequence-to-value" for customised shifted horizon forecasting
What happened + What you expected to happen
Hi, I'm a beginner on deep learning time-series forcasting and really appreicate about the work on neuralforcast which provide the strong function and comprehensive state of art models for beginner to start with.
Now, I'm tryting to do a sequence-to-value forecasting, where I have hourly based time sequence data. I take input of 24 histroic hour as the historic window, and take single value output of 24th prediction only as the target to forecast.
I noticed there is existing function provided in neuralforecast, which we can define input_size=24 and h=1 (horizon), however this set-up only provides the 1th hour prediction. If I used input_size=24 and h=24 (horizon), then the first 23 hour step is the information I do not need.
Do we have any function support for the described forecasting task now? or we need to do some code modfication on source code? any relevant information is appreciated. Many thanks indeed for help in advance.
Versions / Dependencies
neuralforecast 1.6.4 Python 3.10.12; Windows 10;
Reproduction script
from neuralforecast import NeuralForecast from neuralforecast.models import MLP, NBEATS, NBEATSx, NHITS from neuralforecast.losses.pytorch import MSE, RMSE
horizon = 1 # should be 1 here or ?
Try different hyperparmeters to improve accuracy.
models = [ MLP(h=horizon, input_size = 24*7, batch_size = 16, max_steps=300, scaler_type='minmax', loss= MSE(), valid_loss=MSE(), # early stopping val_check_steps=10, # early stopping early_stop_patience_steps = 5 ),
NHITS(h=horizon,
input_size = 24*7,
batch_size = 16,
max_steps=300,
scaler_type='minmax',
loss= MSE(),
valid_loss=MSE(), # early stopping
val_check_steps=10, # early stopping
early_stop_patience_steps = 5
),
NBEATS(h=horizon,
input_size = 24*7,
stack_types=['identity'],
batch_size = 16,
max_steps=300,
scaler_type='minmax',
loss= MSE(),
valid_loss=MSE(), # early stopping
val_check_steps=10, # early stopping
early_stop_patience_steps = 5
),
NBEATSx(h=horizon,
input_size = 24*7,
batch_size = 16,
stack_types=['identity'],
max_steps=300,
scaler_type='minmax',
loss= MSE(),
valid_loss=MSE(), # early stopping
val_check_steps=10, # early stopping
early_stop_patience_steps = 5
)
]
nf = NeuralForecast(models=models, freq='h') Y_hat_df = nf.cross_validation(df=Y_df, val_size = 299,test_size=299, n_windows=None)
Issue Severity
High: It blocks me from completing my task.