mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-05-28 22:56:38 +00:00
'Added checks to cutoffs and error messages if checks fail using ValueError. Fixed earlier bug' (#1718)
* Update error message: Dataframe has no rows #1650, added err msgs * Added error messages and checks for cutoffs"
This commit is contained in:
parent
97bb057de4
commit
4f34de0363
1 changed files with 7 additions and 0 deletions
|
|
@ -140,6 +140,13 @@ def cross_validation(model, horizon, period=None, initial=None, parallel=None, c
|
|||
# Compute Cutoffs
|
||||
cutoffs = generate_cutoffs(df, horizon, initial, period)
|
||||
else:
|
||||
# add validation of the cutoff to make sure that the min cutoff is strictly greater than the min date in the history
|
||||
if min(cutoffs) <= df['ds'].min():
|
||||
raise ValueError("Minimum cutoff value is not strictly greater than min date in history")
|
||||
# max value of cutoffs is <= (end date minus horizon)
|
||||
end_date_minus_horizon = df['ds'].max() - horizon
|
||||
if max(cutoffs) > end_date_minus_horizon:
|
||||
raise ValueError("Maximum cutoff value is greater than end date minus horizon, no value for cross-validation remaining")
|
||||
initial = cutoffs[0] - df['ds'].min()
|
||||
|
||||
# Check if the initial window
|
||||
|
|
|
|||
Loading…
Reference in a new issue