Skip to content

Commit

Permalink
Merge pull request #193 from tgsmith61591/fix-issue-191
Browse files Browse the repository at this point in the history
[MRG+1] Fix issue 191
  • Loading branch information
tgsmith61591 authored Oct 24, 2019
2 parents 28ba504 + 6af3aab commit 45756a5
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build_tools/azure/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- job: macOS

pool:
vmImage: 'macOS-10.13' # Also have the option of 10.14, if we want that
vmImage: 'macOS-10.14'

# Only need to set this for macOS
variables:
Expand Down
3 changes: 2 additions & 1 deletion build_tools/circle/build_push_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ else
"_static"
"auto_examples"
"includes"
"modules")
"modules"
"usecases")

for artifact in "${artifacts[@]}"
do
Expand Down
7 changes: 7 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ As new releases of pmdarima are pushed out, the following list (introduced in
v0.8.1) will document the latest features.


`v1.3.1 <http://alkaline-ml.com/pmdarima/1.3.1/>`_
--------------------------------------------------

* Fixes `#191 <https://github.com/tgsmith61591/pmdarima/issues/191>`_, an issue where
the OCSB test could raise ``ValueError: negative dimensions are not allowed" in OCSB test``


`v1.3.0 <http://alkaline-ml.com/pmdarima/1.3.0/>`_
--------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pmdarima/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
#
__version__ = "1.3.0"
__version__ = "1.3.1.dev0"

try:
# this var is injected in the setup build to enable
Expand Down
4 changes: 2 additions & 2 deletions pmdarima/arima/seasonality.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def _do_lag(y, lag, omit_na=True):
@staticmethod
def _gen_lags(y, max_lag, omit_na=True):
"""Create the lagged exogenous array used to fit the linear model"""
if max_lag == 0:
if max_lag <= 0:
return np.zeros(y.shape[0])

# delegate down
Expand All @@ -342,7 +342,7 @@ def _fit_ocsb(x, m, lag, max_lag):
y = diff(y_first_order_diff)
ylag = OCSBTest._gen_lags(y, lag)

if max_lag > 0:
if max_lag > -1:
# y = tail(y, -maxlag)
y = y[max_lag:]

Expand Down
1 change: 1 addition & 0 deletions pmdarima/arima/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def configuration(parent_package="", top_path=None):
**blas_info)

config.add_subpackage('tests')
config.add_data_dir('tests/data')

return config

Expand Down
47 changes: 47 additions & 0 deletions pmdarima/arima/tests/data/issue_191.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Month,0
2016-01-01,129.97783044109778
2016-02-01,306.55148688938147
2016-03-01,143.46609586423057
2016-04-01,385.0286675330632
2016-05-01,80.92959253879673
2016-06-01,1058.2157327421448
2016-07-01,1247.051448666004
2016-08-01,1833.1778915985017
2016-09-01,3338.9587951991443
2016-10-01,2855.8336518614783
2016-11-01,3309.5298524577643
2016-12-01,1351.2789542083938
2017-01-01,1920.2101811761734
2017-02-01,2168.912102232124
2017-03-01,3910.982302744965
2017-04-01,3190.3251082433057
2017-05-01,1374.2227079742736
2017-06-01,1403.1415360040357
2017-07-01,953.1645718609441
2017-08-01,1413.5523140947494
2017-09-01,2821.320862583547
2017-10-01,2467.3544074992637
2017-11-01,2976.3257808230696
2017-12-01,2918.4881247635467
2018-01-01,1980.0
2018-02-01,3962.0
2018-03-01,6944.0
2018-04-01,2720.0
2018-05-01,3172.0
2018-06-01,3877.0
2018-07-01,5234.0
2018-08-01,4493.0
2018-09-01,9407.0
2018-10-01,9079.0
2018-11-01,10435.0
2018-12-01,4934.0
2019-01-01,4598.0
2019-02-01,7364.0
2019-03-01,10836.0
2019-04-01,8119.0
2019-05-01,10854.0
2019-06-01,5149.256744318752
2019-07-01,6820.377809726632
2019-08-01,9176.990725800295
2019-09-01,15991.129595953533
2019-10-01,14868.559905791291
16 changes: 16 additions & 0 deletions pmdarima/arima/tests/test_arima.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import pytest
import time
import os
from os.path import abspath, dirname


# initialize the random state
Expand Down Expand Up @@ -1031,3 +1032,18 @@ def test_AutoARIMA_class():
mod.update(test, maxiter=2)
new_endog = mod.model_.arima_res_.data.endog
assert_array_almost_equal(wineind, new_endog)


# "ValueError: negative dimensions are not allowed" in OCSB test
def test_issue_191():
X = pd.read_csv(
os.path.join(abspath(dirname(__file__)), 'data', 'issue_191.csv'))
y = X[X.columns[1]].values
auto_arima(
y,
error_action="warn",
seasonal=True,
m=12,
alpha=0.05,
suppress_warnings=True,
trace=True)
1 change: 0 additions & 1 deletion pmdarima/arima/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .seasonality import CHTest, OCSBTest

__all__ = [
'get_callable',
'is_constant',
'ndiffs',
'nsdiffs'
Expand Down

0 comments on commit 45756a5

Please sign in to comment.