Hi, I've trained an AutoRNN with 1h horizon and no...
# neural-forecast
m
Hi, I've trained an AutoRNN with 1h horizon and now want to predict on a test set (around 6000 hourly points). Is there an efficient way to do this? I'm currently using a moving window loop as below, but I know it's not optimal (especially in Python). Thanks
Copy code
# Use numeric values instead of storing entire dataframes
extended_train = X_train_val.copy()  # Start with the training-validation set
predictions = []
true_values = []

for i in range(test_size):
    # Select the current 1-hour step as a single row
    current_window = X_test.iloc[[i]]
    
    # Predict using the extended training data and extract the numeric value
    prediction_value = nf.predict(extended_train)['AutoRNN'].iloc[0]
    true_value = current_window['y'].iloc[0]
    
    # Store the numeric values directly
    predictions.append(prediction_value)
    true_values.append(true_value)
    
    # Add the current window to the extended training data
    extended_train = pd.concat([extended_train, current_window])

# Compute Mean Absolute Error
mae = mean_absolute_error(true_values, predictions)
print("Mean Absolute Error (MAE):", mae)
j
hey. this is the only way to do it at the moment, we have an issue here to implement it. if you just want one step ahead forecasts instead of using this recursive approach you can use cross validation
🙏 1
m
Hi @José Morales I had a follow-up if you don’t mind: is there an implemented solution for TimeGPT ? i.e. I can set h=1 but forecast more than one 1h step at a time in order to compare with the test set ? Thanks
I saw the add_history parameter, if I set df as my entire dataset (train + test) is that an solution? Or is it biased since it’s not “unseen” data.
j
It depends on if you want truly recursive predictions as in your example. If you're fine with just predicting one step at a time then you can use the cross validation method
👍 1
m
One more follow-up: I have a dataframe df with all the necessary columns and no missing values (as required by TimeGPT). Do you know why I get this error when using the API? Thanks again
j
The finetune loss should be a string
m
Oops, my mistake. Appreciate it!