Data input issue with Lagged Regressor #326
Unanswered
Forecastlife
asked this question in
Q&A - get help using NeuralProphet
Replies: 1 comment 1 reply
-
Hi JV @Forecastlife, It sounds like either a data format issue or data freq issue. Might your data be bi-weekly? -> try Else, I suggest instead of transforming a df, creating a fresh df with columns 'ds' and 'y'. BTW, when you are regressing on the series itself, use auto-regression. Hope this helps. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thank you for such a great time series package.. Looking forward to it's bright future.
I am running into an issue with implementing a lagged regressor. I want to forecast a weekly series with the Federal Reserve's Weekly Economic Index. I initialize the data normally then I add the index to the normal ds,y and produce a DF with no zeros in it.
#grab a column
data = pd.DataFrame(rawdata.iloc[:,-1])
#reset index to join
data.reset_index(inplace=True)
#rename for prophet
data = data.rename(columns={'index':'ds'})
data = data.rename(columns={'Domestic':'y'})
WEI.index.names = ['ds']
data = data.join(WEI,on='ds')
#check for nulls
data['WEI'].isnull().values.any()
data['WEI'].isnull().values.sum()
#replace the 1 null in WEI due to data lag
data['WEI']= data['WEI'].fillna(method='ffill')
#init model with AR term
m = nerp(
n_forecasts=3,
n_changepoints=15,
trend_reg=.5,
n_lags=1,
num_hidden_layers=2,
yearly_seasonality=True,
weekly_seasonality=False,
daily_seasonality=False,
seasonality_reg=.7,
seasonality_mode='multiplicative'
)
#add holidays and lagged regressor (because i want prophet to forecast the future WEI)
m = m.add_country_holidays("US", mode="multiplicative", lower_window=-1, upper_window=1)
m = m.add_lagged_regressor(name='WEI')
#fit model
metrics = m.fit(data, freq="W",plot_live_loss=True)
However, when i use the n_lags arg in the NeuralPophet command, I am then returned this error when i run the fit command above:
ValueError: More than 30 consecutive missing values encountered in column y. 383 NA remain. Please preprocess data manually.
I only have 384 values in the dataset so this means some transformation embedded is turning all but one of these values to zeros and then another check is failing the process. I am sure that the input data does not have any zeros. Am i missing a step in the initialization process or is this a bug? I have not tried the "Future Regressor" feature yet but that is my next stop if this does not work out.
Thank's Again
JV
Beta Was this translation helpful? Give feedback.
All reactions