mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +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
|
changepoints <- m$changepoints
|
||||||
if (!is.null(cutoff)) {
|
if (!is.null(cutoff)) {
|
||||||
cutoff <- set_date(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 {
|
} else {
|
||||||
changepoints <- NULL
|
changepoints <- NULL
|
||||||
|
|
|
||||||
|
|
@ -268,8 +268,9 @@ def prophet_copy(m, cutoff=None):
|
||||||
if m.specified_changepoints:
|
if m.specified_changepoints:
|
||||||
changepoints = m.changepoints
|
changepoints = m.changepoints
|
||||||
if cutoff is not None:
|
if cutoff is not None:
|
||||||
# Filter change points '<= cutoff'
|
# Filter change points '< cutoff'
|
||||||
changepoints = changepoints[changepoints <= cutoff]
|
last_history_date = max(m.history['ds'][m.history['ds'] <= cutoff])
|
||||||
|
changepoints = changepoints[changepoints < last_history_date]
|
||||||
else:
|
else:
|
||||||
changepoints = None
|
changepoints = None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue