mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-05-16 21:00:16 +00:00
Validate custom cutoffs for data range (R #1650)
This commit is contained in:
parent
58a0b96550
commit
4e99ac686e
1 changed files with 8 additions and 0 deletions
|
|
@ -110,6 +110,14 @@ cross_validation <- function(
|
|||
cutoffs <- generate_cutoffs(df, horizon.dt, initial.dt, period.dt)
|
||||
}else{
|
||||
cutoffs <- set_date(ds=cutoffs)
|
||||
# Validation
|
||||
if (min(cutoffs) <= min(df$ds)) {
|
||||
stop('Minimum cutoff value is not strictly greater than min date in history')
|
||||
}
|
||||
end_date_minus_horizon <- max(df$ds) - horizon.dt
|
||||
if (max(cutoffs) > end_date_minus_horizon) {
|
||||
stop('Maximum cutoff value is greater than end date minus horizon')
|
||||
}
|
||||
initial.dt <- cutoffs[1] - min(df$ds)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue