Skip to content

Commit 3bcc374

Browse files
authored
Merge pull request #74 from Aristarhys/feature/meta_bump_pyramid_arima
Remove unused pyramid-arima dependency
2 parents f0b9554 + 9ec4eaa commit 3bcc374

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

luminaire/model/lad_structural.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,6 @@ def _seasonal_arima(self, endog=None, exog=None, p=None, d=None, q=None, imodels
230230
:param bool include_holidays: Whether to consider holidays as exogenous
231231
:param list ift_matrix: A list of list All exogenous variables where the ith column is the inverse Fourier
232232
transformation of the time series with first i*2 most relevant frequencies
233-
:param int train_len: Storing the length of the time series
234-
:param int pred_len: Storing the length of the future time points to predict
235-
:param bool arima_error: Storing whether there is any exception occurred in the auto_arima run
236233
:param list stepwise_fit: A list storing different model object
237234
:param bool optimize: Flag to identify whether called from hyperparameter optimization
238235
:param list x_pred: list storing exogenous variable corresponding to the time point to predict
@@ -252,8 +249,7 @@ def _seasonal_arima(self, endog=None, exog=None, p=None, d=None, q=None, imodels
252249
exog['fourier_feature'] = np.float64(np.real(fourier_exog[:, 0]))
253250

254251
# This check is required due to a bug in statsmodel arima which inflates the predictions and std error
255-
# for time series containing only 0's. Can be removed if fixed in a later version of statsmodel
256-
# or pyramid
252+
# for time series containing only 0's. TODO: Can be removed if fixed in a later version of statsmodels
257253
if np.count_nonzero(endog) == 0:
258254
idx_max = len(endog) // 2
259255
idx = int(np.random.randint(0, idx_max, 1)[0])

luminaire/tests/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ def training_test_data():
6969

7070
return data
7171

72+
@pytest.fixture(scope='session')
73+
def training_test_data_zeroes():
74+
"""
75+
Data with all zeroes to test lad structural training
76+
"""
77+
78+
data = pd.read_csv(get_data_path('daily_test_time_series.csv'))
79+
data['index'] = pd.DatetimeIndex(data['index'])
80+
data['raw'] = np.zeros_like(np.array(data['raw']))
81+
data['interpolated'] = data['raw']
82+
data = pd.DataFrame(data, columns=['index', 'raw', 'interpolated']).set_index('index')
83+
84+
return data
85+
86+
7287
@pytest.fixture(scope='session')
7388
def scoring_test_data():
7489
"""

luminaire/tests/test_models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ def test_lad_structural_training(self, training_test_data):
1616

1717
assert success and isinstance(model, LADStructuralModel)
1818

19+
def test_lad_structural_training_zeroes(self, training_test_data_zeroes):
20+
21+
hyper_params = LADStructuralHyperParams(is_log_transformed=False, p=4, q=0).params
22+
lad_struct_obj = LADStructuralModel(hyper_params, freq='D')
23+
data_summary = {'ts_start': training_test_data_zeroes.first_valid_index(),
24+
'ts_end': training_test_data_zeroes.last_valid_index(),
25+
'is_log_transformed': False}
26+
success, ts_end, model = lad_struct_obj.train(data=training_test_data_zeroes, **data_summary)
27+
28+
assert success and isinstance(model, LADStructuralModel)
29+
30+
1931
def test_lad_structural_scoring(self, scoring_test_data, lad_structural_model):
2032

2133
pred_date_normal = scoring_test_data.index[0]

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ hyperopt==0.1.2
44
numpy==1.17.0
55
pandas==0.25.1
66
pykalman==0.9.5
7-
pyramid-arima==0.6.2
87
scipy==1.2.2
98
statsmodels==0.10.1
109
scikit-learn==0.19.1

0 commit comments

Comments
 (0)