Hello, I'm trying to implement an auto NBEATS mode...
# neural-forecast
b
Hello, I'm trying to implement an auto NBEATS model and crossvalidate it. When running the crossvalidation it appears to work but then suddenly stops and displays this error message:
*TypeError*: TimeSeriesDataModule.__init__() got an unexpected keyword argument 'config'
. When using the ray backend another error happens as well. I also tried fitting the model outside of crossvallidation and got this:
*AttributeError*: 'DataFrame' object has no attribute 'temporal_cols'
Not really sure what is going on, I'm running this on anaconda3 in python3.10.4. Any help is appreciated. This is my code:
Copy code
windows = (validation_size - horizon + 1) // horizon
cv_results = nf.cross_validation(df, n_windows=windows, step_size=horizon, config = None)


horizon = 12    
nf = NeuralForecast(
    models=[
        AutoNBEATS(h=horizon, num_samples=5, gpus=1, loss=MQLoss(), backend='optuna', alias="NBEATS ray "),
    ],  
    freq='h'
        )  
windows = (validation_size - horizon + 1) // horizon
cv_results = nf.cross_validation(df, n_windows=windows, step_size=horizon, config = None)
j
Why are you passing
config=None
to cross_validation?
b
To get the standard config, is that wrong?
j
That's an argument of the model, so it should go inside
AutoNBEATS
not in the
cross_validation
call
b
Oh my god, how did not see that. So sorry. I'll run it again and see if anything else pops up
j
no worries. let us know if you run into any problems
b
It ran fine thanks, any ideas why this happens:
*AttributeError*: 'DataFrame' object has no attribute 'temporal_cols'
j
What's the code that you're running when you get that error?
b
It seems I forgot to paste it, this one here:
Copy code
model = AutoNBEATS(h=12, num_samples=5, gpus=1, loss=MQLoss(), backend='optuna', alias="NBEATS ray ")
model.fit(dataset=df)
j
you have to put that model in a NeuralForecast object and call fit on that, as you do with the cross_validation above
b
I see, makes sense. I think there might be a mistake in the docs then. In the AutoNBEATS example it uses it like I have.
j
That example builds the dataset at the top:
Copy code
# Split train/test and declare time series dataset
Y_train_df = Y_df[Y_df.ds<='1959-12-31'] # 132 train
Y_test_df = Y_df[Y_df.ds>'1959-12-31']   # 12 test
dataset, *_ = TimeSeriesDataset.from_df(Y_train_df)
but you should prefer the NeuralForecast object
b
I missed that part, my mistake. Thanks for the tip and thank you so much for the help.