From b96800e423b1d85b8a72a9bb1752c72293b07d15 Mon Sep 17 00:00:00 2001 From: bl Date: Wed, 30 May 2018 14:36:36 -0700 Subject: [PATCH] Replace assertions with error messages --- python/fbprophet/forecaster.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/fbprophet/forecaster.py b/python/fbprophet/forecaster.py index 5eb0988..deb749a 100644 --- a/python/fbprophet/forecaster.py +++ b/python/fbprophet/forecaster.py @@ -267,7 +267,11 @@ class Prophet(object): else: df['floor'] = 0 if self.growth == 'logistic': - assert 'cap' in df + if 'cap' not in df: + raise ValueError( + "Capacities must be supplied for logistic growth in " + "column 'cap'" + ) df['cap_scaled'] = (df['cap'] - df['floor']) / self.y_scale df['t'] = (df['ds'] - self.start) / self.t_scale @@ -522,7 +526,8 @@ class Prophet(object): prior_scale = float(self.holidays_prior_scale) if mode is None: mode = self.seasonality_mode - assert prior_scale > 0 + if prior_scale <= 0: + raise ValueError('Prior scale must be > 0') if mode not in ['additive', 'multiplicative']: raise ValueError("mode must be 'additive' or 'multiplicative'") self.extra_regressors[name] = {