浏览代码

Remove vestigial comments, structure imports

bl 7 年之前
父节点
当前提交
f8775433c9

+ 0 - 6
R/R/prophet.R

@@ -97,8 +97,6 @@ prophet <- function(df = NULL,
                     fit = TRUE,
                     fit = TRUE,
                     ...
                     ...
 ) {
 ) {
-  # fb-block 1
-
   if (!is.null(changepoints)) {
   if (!is.null(changepoints)) {
     n.changepoints <- length(changepoints)
     n.changepoints <- length(changepoints)
   }
   }
@@ -139,8 +137,6 @@ prophet <- function(df = NULL,
   if ((fit) && (!is.null(df))) {
   if ((fit) && (!is.null(df))) {
     m <- fit.prophet(m, df, ...)
     m <- fit.prophet(m, df, ...)
   }
   }
-
-  # fb-block 2
   return(m)
   return(m)
 }
 }
 
 
@@ -1509,5 +1505,3 @@ make_future_dataframe <- function(m, periods, freq = 'day',
   }
   }
   return(data.frame(ds = dates))
   return(data.frame(ds = dates))
 }
 }
-
-# fb-block 3

+ 0 - 1
python/fbprophet/diagnostics.py

@@ -17,7 +17,6 @@ import logging
 import numpy as np
 import numpy as np
 import pandas as pd
 import pandas as pd
 
 
-
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
 
 
 
 

+ 5 - 13
python/fbprophet/forecaster.py

@@ -17,8 +17,12 @@ import warnings
 
 
 import numpy as np
 import numpy as np
 import pandas as pd
 import pandas as pd
+try:
+    import pystan  # noqa F401
+except ImportError:
+    logger.exception('You cannot run fbprophet without pystan installed')
 
 
-# fb-block 1 start
+from fbprophet.diagnostics import prophet_copy
 from fbprophet.models import prophet_stan_model
 from fbprophet.models import prophet_stan_model
 from fbprophet.plot import (
 from fbprophet.plot import (
     plot,
     plot,
@@ -29,21 +33,11 @@ from fbprophet.plot import (
     plot_yearly,
     plot_yearly,
     plot_seasonality,
     plot_seasonality,
 )
 )
-from fbprophet.diagnostics import prophet_copy
-# fb-block 1 end
 
 
 logging.basicConfig()
 logging.basicConfig()
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
 warnings.filterwarnings("default", category=DeprecationWarning)
 warnings.filterwarnings("default", category=DeprecationWarning)
 
 
-try:
-    import pystan  # noqa F401
-except ImportError:
-    logger.error('You cannot run prophet without pystan installed')
-    raise
-
-# fb-block 2
-
 
 
 class Prophet(object):
 class Prophet(object):
     """Prophet forecaster.
     """Prophet forecaster.
@@ -903,7 +897,6 @@ class Prophet(object):
         k = (L0 - L1) / T
         k = (L0 - L1) / T
         return (k, m)
         return (k, m)
 
 
-    # fb-block 7
     def fit(self, df, **kwargs):
     def fit(self, df, **kwargs):
         """Fit the Prophet model.
         """Fit the Prophet model.
 
 
@@ -1024,7 +1017,6 @@ class Prophet(object):
 
 
         return self
         return self
 
 
-    # fb-block 8
     def predict(self, df=None):
     def predict(self, df=None):
         """Predict using the prophet model.
         """Predict using the prophet model.
 
 

+ 0 - 7
python/fbprophet/models.py

@@ -11,22 +11,15 @@ from __future__ import print_function
 from __future__ import unicode_literals
 from __future__ import unicode_literals
 
 
 import pickle
 import pickle
-
-# fb-block 1 start
 import pkg_resources
 import pkg_resources
-# fb-block 1 end
-# fb-block 2
 
 
 
 
 def get_prophet_stan_model():
 def get_prophet_stan_model():
     """Load compiled Stan model"""
     """Load compiled Stan model"""
-    # fb-block 3
-    # fb-block 4 start
     model_file = pkg_resources.resource_filename(
     model_file = pkg_resources.resource_filename(
         'fbprophet',
         'fbprophet',
         'stan_model/prophet_model.pkl',
         'stan_model/prophet_model.pkl',
     )
     )
-    # fb-block 4 end
     with open(model_file, 'rb') as f:
     with open(model_file, 'rb') as f:
         return pickle.load(f)
         return pickle.load(f)
 
 

+ 2 - 5
python/fbprophet/tests/test_diagnostics.py

@@ -11,13 +11,12 @@ from __future__ import print_function
 from __future__ import unicode_literals
 from __future__ import unicode_literals
 
 
 import itertools
 import itertools
+import os
+from unittest import TestCase
 
 
 import numpy as np
 import numpy as np
 import pandas as pd
 import pandas as pd
 
 
-# fb-block 1 start
-import os
-from unittest import TestCase
 from fbprophet import Prophet
 from fbprophet import Prophet
 from fbprophet import diagnostics
 from fbprophet import diagnostics
 
 
@@ -25,8 +24,6 @@ DATA_all = pd.read_csv(
     os.path.join(os.path.dirname(__file__), 'data.csv'), parse_dates=['ds']
     os.path.join(os.path.dirname(__file__), 'data.csv'), parse_dates=['ds']
 )
 )
 DATA = DATA_all.head(100)
 DATA = DATA_all.head(100)
-# fb-block 1 end
-# fb-block 2
 
 
 
 
 class TestDiagnostics(TestCase):
 class TestDiagnostics(TestCase):

+ 3 - 5
python/fbprophet/tests/test_prophet.py

@@ -10,12 +10,12 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import print_function
 from __future__ import unicode_literals
 from __future__ import unicode_literals
 
 
+import os
+from unittest import TestCase
+
 import numpy as np
 import numpy as np
 import pandas as pd
 import pandas as pd
 
 
-# fb-block 1 start
-import os
-from unittest import TestCase
 from fbprophet import Prophet
 from fbprophet import Prophet
 
 
 DATA = pd.read_csv(
 DATA = pd.read_csv(
@@ -26,8 +26,6 @@ DATA2 = pd.read_csv(
     os.path.join(os.path.dirname(__file__), 'data2.csv'),
     os.path.join(os.path.dirname(__file__), 'data2.csv'),
     parse_dates=['ds'],
     parse_dates=['ds'],
 )
 )
-# fb-block 1 end
-# fb-block 2
 
 
 
 
 class TestProphet(TestCase):
 class TestProphet(TestCase):