Happy holidays! Can you help me understand how to ...
# neural-forecast
j
Happy holidays! Can you help me understand how to use nbeats and nhits? as you can see, i have a time series and both models not recognizing the seasonalities. but the autoarima in Nixtla works well with the same data. here is the code for the two models. anything i need to change? #note: horizon = 12 month, it’s at the beginning of the month like ‘2022-02-01’ models = [NBEATS(input_size=2 * horizon, h=horizon, max_epochs=50), NHITS(input_size=2 * horizon, h=horizon, max_epochs=50)] nforecast = NeuralForecast(models=models, freq=‘MS’)
k
Hi @J T, The way that one can accomodate seasonalities in the NHITS model is through the
n_freq_downsample
parameter. • In your case with monthly data you can try for example
n_freq_downsample=[6,3,1]
. • It seems that the scale of your data might be challenging too, you might want to try the
scaler_type='norm'
to help the optimization of the network (even ReLU nonlinearities might struggle with very large signals). • You might want to train the network for a bit longer epochs.
j
@Kin Gtz. Olivares, thanks for advice. i have increase the epochs = 100, and added downsamples as you suggested. thing did changed afterwards. but still not close. may try scaler next. but seasonality is not included it the model, so far.
i check a post and it seems their nbeats not forecasting seasonality ups an downs either: https://pytorch-forecasting.readthedocs.io/en/stable/tutorials/ar.html
also, how to import AutoNHITS? from neuralforecast.models import AutoNHITS , AutoNBEATS does not work.
k
Copy code
from neuralforecast.auto import (
    AutoMLP, AutoNBEATS, 
    AutoRNN, AutoTCN, AutoDilatedRNN,
)
👍 1
I think that the scale might be challenging to the models. Can you try the Box-Cox transform, taking logarithms of your data and then training the network?