Skip to content

Commit a340047

Browse files
authored
update python, tests, and docs (#279)
1 parent bd4c473 commit a340047

File tree

9 files changed

+51
-31
lines changed

9 files changed

+51
-31
lines changed

.github/workflows/tests.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
python-version: [3.6, 3.7, 3.8]
14+
python-version: ['3.8', '3.9', '3.10', '3.11']
1515
os: [ubuntu-20.04, macos-latest]
1616
steps:
1717
- uses: actions/checkout@v1
@@ -20,15 +20,17 @@ jobs:
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install package
23-
run: pip install .[dev]
23+
run: |
24+
pip install --upgrade pip setuptools wheel
25+
pip install .[dev]
2426
- name: make test-devel
2527
run: make test-devel
2628

2729
readme:
2830
runs-on: ${{ matrix.os }}
2931
strategy:
3032
matrix:
31-
python-version: [3.6, 3.7, 3.8]
33+
python-version: ['3.8', '3.9', '3.10', '3.11']
3234
os: [ubuntu-20.04, macos-latest]
3335
steps:
3436
- uses: actions/checkout@v1
@@ -37,15 +39,17 @@ jobs:
3739
with:
3840
python-version: ${{ matrix.python-version }}
3941
- name: Install package and dependencies
40-
run: pip install rundoc .
42+
run: |
43+
pip install --upgrade pip setuptools wheel
44+
pip install rundoc .
4145
- name: make test-readme
4246
run: make test-readme
4347

4448
unit:
4549
runs-on: ${{ matrix.os }}
4650
strategy:
4751
matrix:
48-
python-version: [3.6, 3.7, 3.8]
52+
python-version: ['3.8', '3.9', '3.10', '3.11']
4953
os: [ubuntu-20.04, macos-latest]
5054
steps:
5155
- uses: actions/checkout@v1
@@ -54,6 +58,8 @@ jobs:
5458
with:
5559
python-version: ${{ matrix.python-version }}
5660
- name: Install package and dependencies
57-
run: pip install .[test]
61+
run: |
62+
pip install --upgrade pip setuptools wheel
63+
pip install .[test]
5864
- name: make test-unit
5965
run: make test-unit

mlprimitives/adapters/statsmodels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
from statsmodels.tsa import arima_model
2+
from statsmodels.tsa.arima import model
33

44

55
class ARIMA(object):
@@ -45,8 +45,8 @@ def predict(self, X):
4545

4646
num_sequences = len(X)
4747
for sequence in range(num_sequences):
48-
arima = arima_model.ARIMA(X[sequence], order=(self.p, self.d, self.q))
49-
arima_fit = arima.fit(disp=0)
48+
arima = model.ARIMA(X[sequence], order=(self.p, self.d, self.q))
49+
arima_fit = arima.fit()
5050
arima_results.append(arima_fit.forecast(self.steps)[0])
5151

5252
arima_results = np.asarray(arima_results)

mlprimitives/custom/timeseries_preprocessing.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,8 @@ def cutoff_window_sequences(X, timeseries, window_size, cutoff_time=None, time_i
269269

270270
output.append(selected.values)
271271

272-
return np.array(output)
272+
output = np.array(output, dtype=object)
273+
if output.ndim >= 2:
274+
output = output.astype(float)
275+
276+
return output

mlprimitives/primitives/xgboost.XGBClassifier.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"args": [
3030
{
3131
"name": "X",
32-
"keyword": "data",
3332
"type": "ndarray"
3433
}
3534
],

mlprimitives/primitives/xgboost.XGBRegressor.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"args": [
3030
{
3131
"name": "X",
32-
"keyword": "data",
3332
"type": "ndarray"
3433
}
3534
],

setup.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
history = history_file.read()
1313

1414
install_requires = [
15-
'Keras>=2.4,<2.5',
15+
'Keras>=2.4,<2.15',
1616
'featuretools>=0.6.1,<0.23',
1717
'iso639>=0.1.4,<0.2',
1818
'langdetect>=1.0.7,<2',
1919
'lightfm>=1.15,<2',
20-
'mlblocks>=0.4.0.dev0,<0.7',
20+
'mlblocks>=0.6,<0.7',
2121
'networkx>=2.0,<3',
2222
'nltk>=3.3,<4',
23-
'numpy<1.21.0,>=1.16.0',
23+
'numpy>=1.16.0,<2',
2424
'opencv-python>=3.4.0.12,<4.7',
2525
'pandas>=1,<2',
2626
'python-louvain>=0.10,<0.14', # community
2727
'scikit-image>=0.15',
2828
'scikit-learn>=0.21',
2929
'scipy>=1.1.0,<2',
30-
'statsmodels>=0.9.0,<0.13',
31-
'tensorflow>=2,<2.5',
32-
'xgboost>=0.72.1,<1',
30+
'statsmodels>=0.9.0,<0.15',
31+
'tensorflow>=2,<2.15',
32+
'xgboost>=0.72.1,<2',
3333
'protobuf<4',
3434
]
3535

@@ -59,6 +59,15 @@
5959
'mistune>=0.7,<2',
6060
'Jinja2>=2,<3.1',
6161

62+
# fails on Sphinx < v3.4
63+
'alabaster<=0.7.12',
64+
# fails on Sphins < v5.0
65+
'sphinxcontrib-applehelp<1.0.8',
66+
'sphinxcontrib-devhelp<1.0.6',
67+
'sphinxcontrib-htmlhelp<2.0.5',
68+
'sphinxcontrib-serializinghtml<1.1.10',
69+
'sphinxcontrib-qthelp<1.0.7',
70+
6271
# style check
6372
'flake8>=3.7.7,<4',
6473
'isort>=4.3.4,<5',
@@ -91,9 +100,10 @@
91100
'License :: OSI Approved :: MIT License',
92101
'Natural Language :: English',
93102
'Programming Language :: Python :: 3',
94-
'Programming Language :: Python :: 3.6',
95-
'Programming Language :: Python :: 3.7',
96103
'Programming Language :: Python :: 3.8',
104+
'Programming Language :: Python :: 3.9',
105+
'Programming Language :: Python :: 3.10',
106+
'Programming Language :: Python :: 3.11',
97107
],
98108
description='Pipelines and primitives for machine learning and data science.',
99109
entry_points = {
@@ -117,7 +127,7 @@
117127
long_description_content_type='text/markdown',
118128
name='mlprimitives',
119129
packages=find_packages(include=['mlprimitives', 'mlprimitives.*']),
120-
python_requires='>=3.6,<3.9',
130+
python_requires='>=3.8,<3.12',
121131
setup_requires=setup_requires,
122132
test_suite='tests',
123133
tests_require=tests_require,

tests/adapters/test_statsmodels.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from mlprimitives.adapters.statsmodels import ARIMA
77

88

9-
@patch('statsmodels.tsa.arima_model.ARIMA')
9+
@patch('statsmodels.tsa.arima.model.ARIMA')
1010
def test_arima_1d(arima_mock):
1111
arima = ARIMA(1, 0, 0, 3)
1212
X = np.array([1, 2, 3, 4, 5])
@@ -15,7 +15,7 @@ def test_arima_1d(arima_mock):
1515
assert arima_mock.call_args[1] == {'order': (1, 0, 0)}
1616

1717

18-
@patch('statsmodels.tsa.arima_model.ARMAResults.forecast')
18+
@patch('statsmodels.tsa.arima.model.ARIMAResultsWrapper.forecast')
1919
def test_predict_1d(arima_mock):
2020
arima_mock.return_value = [[1, 2, 3]]
2121

@@ -29,7 +29,7 @@ def test_predict_1d(arima_mock):
2929
arima_mock.assert_called_once_with(3)
3030

3131

32-
@patch('statsmodels.tsa.arima_model.ARIMA')
32+
@patch('statsmodels.tsa.arima.model.ARIMA')
3333
def test_arima_2d(arima_mock):
3434
arima = ARIMA(1, 0, 0, 3)
3535
X = np.array([
@@ -46,7 +46,7 @@ def test_arima_2d(arima_mock):
4646
assert arima_mock.call_args_list[2][1] == {'order': (1, 0, 0)}
4747

4848

49-
@patch('statsmodels.tsa.arima_model.ARMAResults.forecast')
49+
@patch('statsmodels.tsa.arima.model.ARIMAResultsWrapper.forecast')
5050
def test_predict_2d(arima_mock):
5151
arima_mock.side_effect = [
5252
[[1, 2, 3]],

tests/custom/test_timeseries_preprocessing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def test_not_enough_data(self):
417417
[15, 35],
418418
[16, 36]
419419
])
420-
])
420+
], dtype=object)
421421

422422
assert_allclose(
423423
array[0],

tox.ini

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
[tox]
2-
envlist = py3{6,7,8}, test-devel
2+
envlist = py3{8,9,10,11}, test-devel
33

44
[travis]
55
python =
66
3.8: py38, test-devel
7-
3.7: py37
8-
3.6: py36
7+
3.9: py39
8+
3.10: py310
9+
3.11: py311
910

1011
[gh-actions]
1112
python =
1213
3.8: py38, test-devel
13-
3.7: py37
14-
3.6: py36
14+
3.9: py39
15+
3.10: py310
16+
3.11: py311
1517

1618
[testenv]
1719
passenv = CI TRAVIS TRAVIS_*

0 commit comments

Comments
 (0)