mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
lint fixes
This commit is contained in:
parent
d48b70b106
commit
fb517b53d6
2 changed files with 10 additions and 10 deletions
|
|
@ -28,7 +28,7 @@ from fbprophet.models import prophet_stan_models
|
||||||
# fb-block 1 end
|
# fb-block 1 end
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pystan
|
import pystan # noqa F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.error('You cannot run prophet without pystan installed')
|
logger.error('You cannot run prophet without pystan installed')
|
||||||
raise
|
raise
|
||||||
|
|
@ -312,7 +312,7 @@ class Prophet(object):
|
||||||
expanded_holidays = defaultdict(lambda: np.zeros(dates.shape[0]))
|
expanded_holidays = defaultdict(lambda: np.zeros(dates.shape[0]))
|
||||||
# Makes an index so we can perform `get_loc` below.
|
# Makes an index so we can perform `get_loc` below.
|
||||||
# Strip to just dates.
|
# Strip to just dates.
|
||||||
row_index = pd.DatetimeIndex(dates.apply(lambda x:x.date()))
|
row_index = pd.DatetimeIndex(dates.apply(lambda x: x.date()))
|
||||||
|
|
||||||
for _ix, row in self.holidays.iterrows():
|
for _ix, row in self.holidays.iterrows():
|
||||||
dt = row.ds.date()
|
dt = row.ds.date()
|
||||||
|
|
@ -449,7 +449,7 @@ class Prophet(object):
|
||||||
|
|
||||||
# Weekly seasonality
|
# Weekly seasonality
|
||||||
weekly_disable = ((last - first < pd.Timedelta(weeks=2)) or
|
weekly_disable = ((last - first < pd.Timedelta(weeks=2)) or
|
||||||
(min_dt >= pd.Timedelta(weeks=1)))
|
(min_dt >= pd.Timedelta(weeks=1)))
|
||||||
fourier_order = self.parse_seasonality_args(
|
fourier_order = self.parse_seasonality_args(
|
||||||
'weekly', self.weekly_seasonality, weekly_disable, 3)
|
'weekly', self.weekly_seasonality, weekly_disable, 3)
|
||||||
if fourier_order > 0:
|
if fourier_order > 0:
|
||||||
|
|
@ -457,7 +457,7 @@ class Prophet(object):
|
||||||
|
|
||||||
# Daily seasonality
|
# Daily seasonality
|
||||||
daily_disable = ((last - first < pd.Timedelta(days=2)) or
|
daily_disable = ((last - first < pd.Timedelta(days=2)) or
|
||||||
(min_dt >= pd.Timedelta(days=1)))
|
(min_dt >= pd.Timedelta(days=1)))
|
||||||
fourier_order = self.parse_seasonality_args(
|
fourier_order = self.parse_seasonality_args(
|
||||||
'daily', self.daily_seasonality, daily_disable, 4)
|
'daily', self.daily_seasonality, daily_disable, 4)
|
||||||
if fourier_order > 0:
|
if fourier_order > 0:
|
||||||
|
|
@ -1056,7 +1056,7 @@ class Prophet(object):
|
||||||
ax=ax, uncertainty=uncertainty, yearly_start=yearly_start)
|
ax=ax, uncertainty=uncertainty, yearly_start=yearly_start)
|
||||||
else:
|
else:
|
||||||
self.plot_seasonality(
|
self.plot_seasonality(
|
||||||
name=plot, ax=ax, uncertainty=uncertainty)
|
name=plot, ax=ax, uncertainty=uncertainty)
|
||||||
|
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
return fig
|
return fig
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,13 @@ 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
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
# fb-block 1 start
|
# fb-block 1 start
|
||||||
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from fbprophet import Prophet
|
from fbprophet import Prophet
|
||||||
# fb-block 1 end
|
|
||||||
# fb-block 2
|
|
||||||
|
|
||||||
DATA = pd.read_csv(
|
DATA = pd.read_csv(
|
||||||
os.path.join(os.path.dirname(__file__), 'data.csv'),
|
os.path.join(os.path.dirname(__file__), 'data.csv'),
|
||||||
|
|
@ -29,6 +26,9 @@ 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):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue