I have a dataframe like this:
ds-----------y
2019-01-01---100
2019-02-01---200
2019-03-01---300
...
2020-03-01---100
And I want to cross_val this one
prophet = Prophet(
growth = 'linear',
holidays=df_holidays,
yearly_seasonality=True,
seasonality_mode='additive'
)
prophet.fit(trend_df)
and in this part I have a problem:
cv_results = cross_validation(
prophet,
initial = '470 days',
period = '30 days',
horizon = '270 days',
)
ValueError: Less data than horizon after initial window. Make horizon or initial shorter.
I need:
initial model with count days between 01-01-2019
and 01-03-2020
,
get a moving window with 30 days (1 month) and stop my model in 01-12-2020
thanks a lot
Cross validation only deals with historic data, no future ones. If you are trying to validate your existing data, you should lower the horizon until it is within the date range - the initial predicting data ("initial = '470 days' ") And, as the initial date is further then the last date available, it will always bring the error.
If you are trying to predict future dates from this existing dataframe, you should use
future = m.make_future_dataframe(periods=1826)
future['cap'] = 8.5
fcst = m.predict(future)
fig = m.plot(fcst)