mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
style/comment fixes
This commit is contained in:
parent
bc542ed66f
commit
5474fe3bd3
2 changed files with 8 additions and 6 deletions
|
|
@ -20,7 +20,9 @@ from matplotlib.ticker import FuncFormatter
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
# fb-block 1 start
|
||||||
from fbprophet.models import prophet_stan_models
|
from fbprophet.models import prophet_stan_models
|
||||||
|
# fb-block 1 end
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pystan
|
import pystan
|
||||||
|
|
@ -383,7 +385,7 @@ class Prophet(object):
|
||||||
dt = self.history['ds'].diff()
|
dt = self.history['ds'].diff()
|
||||||
min_dt = dt.iloc[dt.nonzero()[0]].min()
|
min_dt = dt.iloc[dt.nonzero()[0]].min()
|
||||||
if ((last - first < pd.Timedelta(weeks=2)) or
|
if ((last - first < pd.Timedelta(weeks=2)) or
|
||||||
(min_dt >= pd.Timedelta(weeks=1))):
|
(min_dt >= pd.Timedelta(weeks=1))):
|
||||||
self.weekly_seasonality = False
|
self.weekly_seasonality = False
|
||||||
print('Disabling weekly seasonality. Run prophet with '
|
print('Disabling weekly seasonality. Run prophet with '
|
||||||
'weekly_seasonality=True to override this.')
|
'weekly_seasonality=True to override this.')
|
||||||
|
|
@ -539,8 +541,8 @@ class Prophet(object):
|
||||||
# If no changepoints were requested, replace delta with 0s
|
# If no changepoints were requested, replace delta with 0s
|
||||||
if len(self.changepoints) == 0:
|
if len(self.changepoints) == 0:
|
||||||
# Fold delta into the base rate k
|
# Fold delta into the base rate k
|
||||||
params['k'] = params['k'] + params['delta']
|
self.params['k'] = self.params['k'] + self.params['delta']
|
||||||
params['delta'] = np.zeros(params['delta'].shape)
|
self.params['delta'] = np.zeros(self.params['delta'].shape)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
@ -1093,6 +1095,3 @@ class Prophet(object):
|
||||||
ax.set_xlabel('Day of year')
|
ax.set_xlabel('Day of year')
|
||||||
ax.set_ylabel('yearly')
|
ax.set_ylabel('yearly')
|
||||||
return artists
|
return artists
|
||||||
|
|
||||||
|
|
||||||
# fb-block 9
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ import pickle
|
||||||
# fb-block 1 start
|
# fb-block 1 start
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
# fb-block 1 end
|
# fb-block 1 end
|
||||||
|
# fb-block 2
|
||||||
|
|
||||||
|
|
||||||
def get_prophet_stan_model(model):
|
def get_prophet_stan_model(model):
|
||||||
"""Load compiled Stan model"""
|
"""Load compiled Stan model"""
|
||||||
|
|
@ -28,6 +30,7 @@ def get_prophet_stan_model(model):
|
||||||
with open(model_file, 'rb') as f:
|
with open(model_file, 'rb') as f:
|
||||||
return pickle.load(f)
|
return pickle.load(f)
|
||||||
|
|
||||||
|
|
||||||
prophet_stan_models = {
|
prophet_stan_models = {
|
||||||
'linear': get_prophet_stan_model('linear'),
|
'linear': get_prophet_stan_model('linear'),
|
||||||
'logistic': get_prophet_stan_model('logistic'),
|
'logistic': get_prophet_stan_model('logistic'),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue