From 3ebedb111004ac97378ab497a8636b86c45296bd Mon Sep 17 00:00:00 2001 From: bl Date: Mon, 3 Jul 2017 21:29:38 -0700 Subject: [PATCH] Use abs for scaling y --- R/R/prophet.R | 2 +- python/fbprophet/forecaster.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/R/prophet.R b/R/R/prophet.R index 5b2dd81..93dc61b 100644 --- a/R/R/prophet.R +++ b/R/R/prophet.R @@ -226,7 +226,7 @@ setup_dataframe <- function(m, df, initialize_scales = FALSE) { dplyr::arrange(ds) if (initialize_scales) { - m$y.scale <- max(df$y) + m$y.scale <- max(abs(df$y)) m$start <- min(df$ds) m$t.scale <- as.numeric(max(df$ds) - m$start) } diff --git a/python/fbprophet/forecaster.py b/python/fbprophet/forecaster.py index 4175026..a928bd1 100644 --- a/python/fbprophet/forecaster.py +++ b/python/fbprophet/forecaster.py @@ -179,7 +179,7 @@ class Prophet(object): df.reset_index(inplace=True, drop=True) if initialize_scales: - self.y_scale = df['y'].max() + self.y_scale = df['y'].abs().max() self.start = df['ds'].min() self.t_scale = df['ds'].max() - self.start