diff --git a/python/prophet/diagnostics.py b/python/prophet/diagnostics.py index cbfbc64..c25be97 100644 --- a/python/prophet/diagnostics.py +++ b/python/prophet/diagnostics.py @@ -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)