mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-07-29 20:14:08 +00:00
Fix bug in changepoint handling in prophet_copy (#1529)
This commit is contained in:
parent
fb6552137c
commit
a519043f1b
2 changed files with 5 additions and 3 deletions
|
|
@ -181,7 +181,8 @@ prophet_copy <- function(m, cutoff = NULL) {
|
|||
changepoints <- m$changepoints
|
||||
if (!is.null(cutoff)) {
|
||||
cutoff <- set_date(cutoff)
|
||||
changepoints <- changepoints[changepoints <= cutoff]
|
||||
last_history_date <- max(m$history$ds[m$history$ds <= cutoff])
|
||||
changepoints <- changepoints[changepoints < last_history_date]
|
||||
}
|
||||
} else {
|
||||
changepoints <- NULL
|
||||
|
|
|
|||
|
|
@ -268,8 +268,9 @@ def prophet_copy(m, cutoff=None):
|
|||
if m.specified_changepoints:
|
||||
changepoints = m.changepoints
|
||||
if cutoff is not None:
|
||||
# Filter change points '<= cutoff'
|
||||
changepoints = changepoints[changepoints <= cutoff]
|
||||
# Filter change points '< cutoff'
|
||||
last_history_date = max(m.history['ds'][m.history['ds'] <= cutoff])
|
||||
changepoints = changepoints[changepoints < last_history_date]
|
||||
else:
|
||||
changepoints = None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue