Explorar el Código

Use abs for scaling y

bl hace 8 años
padre
commit
3ebedb1110
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  1. 1 1
      R/R/prophet.R
  2. 1 1
      python/fbprophet/forecaster.py

+ 1 - 1
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)
   }

+ 1 - 1
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