adding no history error handling to cross_validation (#2140)

This commit is contained in:
Julian Carrasquillo 2022-05-22 13:12:46 -04:00 committed by GitHub
parent 0a44095570
commit cc5484c4e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,7 +114,10 @@ def cross_validation(model, horizon, period=None, initial=None, parallel=None, c
-------
A pd.DataFrame with the forecast, actual value and cutoff.
"""
if model.history is None:
raise Exception('Model has not been fit. Fitting the model provides contextual parameters for cross validation.')
df = model.history.copy().reset_index(drop=True)
horizon = pd.Timedelta(horizon)