diff --git a/R/R/prophet.R b/R/R/prophet.R index 337a349..ead91ea 100644 --- a/R/R/prophet.R +++ b/R/R/prophet.R @@ -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) } diff --git a/python/fbprophet/forecaster.py b/python/fbprophet/forecaster.py index d8096ca..2433dec 100644 --- a/python/fbprophet/forecaster.py +++ b/python/fbprophet/forecaster.py @@ -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