Skip to content

Commit

Permalink
Some more tests, doc
Browse files Browse the repository at this point in the history
  • Loading branch information
tgsmith61591 committed Feb 12, 2018
1 parent c0fd56d commit 659b0a5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pyramid/arima/tests/test_arima.py
Expand Up @@ -233,6 +233,13 @@ def test_many_orders():
suppress_warnings=True, stepwise=True)


def test_small_samples():
# if n_samples < 10, test the new starting p, d, Q
samp = lynx[:8]
auto_arima(samp, suppress_warnings=True, stepwise=True,
error_action='ignore')


def test_with_seasonality1():
fit = ARIMA(order=(1, 1, 1),
seasonal_order=(0, 1, 1, 12),
Expand Down
12 changes: 11 additions & 1 deletion pyramid/arima/tests/test_stationarity.py
@@ -1,4 +1,4 @@
# stationarity tests
# stationarity/seasonality tests

from __future__ import absolute_import
from numpy.testing import assert_array_almost_equal, assert_almost_equal
Expand Down Expand Up @@ -114,6 +114,16 @@ def test_ch_test():
# this won't even go thru because n < 2 * m + 5:
assert CHTest(m=365).estimate_seasonal_differencing_term(austres) == 0

# change the length to be longer so we can actually test the end case
aus_list = austres.tolist() # type: list
y = np.asarray(aus_list * 10) # type: np.ndarray

# y len is now 1760, which is > 2 * m + 5, but idk what to assert
CHTest(m=365).estimate_seasonal_differencing_term(y)

# what if m > 365???
CHTest(m=366).estimate_seasonal_differencing_term(y)


def test_ch_base():
test = CHTest(m=2)
Expand Down
22 changes: 22 additions & 0 deletions pyramid/utils/array.py
Expand Up @@ -200,6 +200,28 @@ def is_iterable(x):
x : str, iterable or object
The object in question.
Examples
--------
Strings and other objects are not iterable:
>>> x = "not me"
>>> y = 123
>>> any(is_iterable(v) for v in (x, y))
False
Tuples, lists and other structures with ``__iter__`` are:
>>> x = ('a', 'tuple')
>>> y = ['a', 'list']
>>> all(is_iterable(v) for v in (x, y))
True
This even applies to numpy arrays:
>>> import numpy as np
>>> is_iterable(np.arange(10))
True
Returns
-------
isiter : bool
Expand Down

0 comments on commit 659b0a5

Please sign in to comment.