mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-07-24 19:43:41 +00:00
Verify that cap > floor (#807)
This commit is contained in:
parent
269133c133
commit
28cd55241f
2 changed files with 7 additions and 0 deletions
|
|
@ -393,6 +393,9 @@ setup_dataframe <- function(m, df, initialize_scales = FALSE) {
|
|||
if (!(exists('cap', where=df))) {
|
||||
stop('Capacities must be supplied for logistic growth.')
|
||||
}
|
||||
if (any(df$cap <= df$floor)) {
|
||||
stop('cap must be greater than floor (which defaults to 0).')
|
||||
}
|
||||
df <- df %>%
|
||||
dplyr::mutate(cap_scaled = (cap - floor) / m$y.scale)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,6 +274,10 @@ class Prophet(object):
|
|||
"Capacities must be supplied for logistic growth in "
|
||||
"column 'cap'"
|
||||
)
|
||||
if (df['cap'] <= df['floor']).any():
|
||||
raise ValueError(
|
||||
'cap must be greater than floor (which defaults to 0).'
|
||||
)
|
||||
df['cap_scaled'] = (df['cap'] - df['floor']) / self.y_scale
|
||||
|
||||
df['t'] = (df['ds'] - self.start) / self.t_scale
|
||||
|
|
|
|||
Loading…
Reference in a new issue