Skip to content

Adding Future Regressor Error #798

Description

@Msaleh87

Discussed in #797

Originally posted by Msaleh87 October 3, 2022
So I prepared my data as shown below:
Screenshot 2022-10-03 165322

This is my code, L12 is the dataset you see in the pic above:

L12M = L_prophet_5min_T[0:(12*30*24*12)] # the dataset show in the above pic
m = NeuralProphet(n_forecasts=(2*24*12),
    n_lags=(16*24*12),
    yearly_seasonality="auto",
    weekly_seasonality="auto",  
    daily_seasonality="auto",
    growth="off", seasonality_reg= 0.5, optimizer = 'AdamW',
    learning_rate = 0.1, n_changepoints="auto", changepoints_range = "auto",  batch_size = 16 ) 

m.add_country_holidays("US", mode="additive") 
m = m.add_future_regressor(name='A')
m = m.add_future_regressor(name='B')
m = m.add_future_regressor(name='C')
metrics = m.fit(L12M, freq="5min") 
m.highlight_nth_step_ahead_of_each_forecast(step_number=m.n_forecasts)

# the future values of A, B, and C
future_regressors_df = pd.DataFrame(data={'A': L_prophet_5min_T['A'][(12*30*24*12):(12*30*24*12)+576], 
                                          'B': L_prophet_5min_T['B'][(12*30*24*12):(12*30*24*12)+576],
                                          'C': L_prophet_5min_T['C'][(12*30*24*12):(12*30*24*12)+576]})

The model trains and saves fine, then when I try to forecast using this code, I get an error:

P_horizon = 576
future = m.make_future_dataframe(df = L12M, periods = P_horizon, n_historic_predictions=True) 
forecast1 = m.predict(df=future)

Screenshot 2022-10-03 170128

Should I add an argument for the future regressors inside the forecast?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions