Skip to content

Commit f89c7e1

Browse files
authored
Updates CI for scikit-learn==1.1 (#107)
* Updates CI for scikit-learn==1.1 * Update kmeans_l1.py * update to the new API
1 parent 0925896 commit f89c7e1

26 files changed

+180
-429
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
name: Install pandoc
1919
command: |
2020
sudo apt-get update
21-
wget https://github.com/jgm/pandoc/releases/download/2.14.1/pandoc-2.14.1-1-amd64.deb
22-
sudo dpkg -i pandoc-2.14.1-1-amd64.deb
21+
wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-1-amd64.deb
22+
sudo dpkg -i pandoc-2.18-1-amd64.deb
2323
2424
- run:
2525
name: Install tex

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ matrix:
99
env:
1010
- sklver=">=0.24.2"
1111
- jlver=">=1.0"
12-
- python: 3.8
13-
name: "Py38-023"
14-
env:
15-
- sklver="==0.23.2"
16-
- jlver="==0.17.0"
1712

1813
before_install:
1914
- sudo apt-get install libgeos-dev libproj-dev proj-data graphviz libblas-dev liblapack-dev

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ Function ``pipeline2dot`` converts a pipeline into a graph:
7676
from mlinsights.plotting import pipeline2dot
7777
dot = pipeline2dot(clf, df)
7878

79-
.. image:: https://github.com/sdpython/mlinsights/raw/master/_doc/pipeline.png
79+
.. image:: https://raw.githubusercontent.com/sdpython/mlinsights/master/_doc/sphinxdoc/source/pipeline.png

_unittests/ut_mlmodel/test_kmeans_l1.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ def test_kmeans_l2_iris(self):
7272
self.assertEqual({0, 1, 2, 3}, cls)
7373

7474
def test_kmeans_l1_check(self):
75-
X = numpy.array([[-10, 1, 2, 3, 4, 10],
76-
[-10, 1, 2, 3, 4, 10]]).T
75+
X = numpy.ascontiguousarray(
76+
numpy.array([[-10, 1, 2, 3, 4, 10],
77+
[-10, 1, 2, 3, 4, 10]]).T)
7778
clr = KMeansL1L2(2, norm='L1')
7879
clr.fit(X)
7980
cls = set(clr.predict(X))

_unittests/ut_mlmodel/test_piecewise_decision_tree_experiment.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_criterions(self):
2626
X = numpy.array([[1., 2.]]).T
2727
y = numpy.array([1., 2.])
2828
c1 = MSE(1, X.shape[0])
29-
c2 = SimpleRegressorCriterion(X)
29+
c2 = SimpleRegressorCriterion(1, X.shape[0])
3030
self.assertNotEmpty(c1)
3131
self.assertNotEmpty(c2)
3232
w = numpy.ones((y.shape[0],))
@@ -49,7 +49,7 @@ def test_criterions(self):
4949
X = numpy.array([[1., 2., 3.]]).T
5050
y = numpy.array([1., 2., 3.])
5151
c1 = MSE(1, X.shape[0])
52-
c2 = SimpleRegressorCriterion(X)
52+
c2 = SimpleRegressorCriterion(1, X.shape[0])
5353
w = numpy.ones((y.shape[0],))
5454
ind = numpy.arange(y.shape[0]).astype(numpy.int64)
5555
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -68,7 +68,7 @@ def test_criterions(self):
6868
X = numpy.array([[1., 2., 10., 11.]]).T
6969
y = numpy.array([0.9, 1.1, 1.9, 2.1])
7070
c1 = MSE(1, X.shape[0])
71-
c2 = SimpleRegressorCriterion(X)
71+
c2 = SimpleRegressorCriterion(1, X.shape[0])
7272
w = numpy.ones((y.shape[0],))
7373
ind = numpy.arange(y.shape[0]).astype(numpy.int64)
7474
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -121,7 +121,7 @@ def test_criterions(self):
121121
X = numpy.array([[1., 2., 10., 11.]]).T
122122
y = numpy.array([0.9, 1.1, 1.9, 2.1])
123123
c1 = MSE(1, X.shape[0])
124-
c2 = SimpleRegressorCriterion(X)
124+
c2 = SimpleRegressorCriterion(1, X.shape[0])
125125
w = numpy.ones((y.shape[0],))
126126
ind = numpy.array([0, 3, 2, 1], dtype=ind.dtype)
127127
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -166,7 +166,8 @@ def test_decision_tree_criterion(self):
166166
clr1.fit(X, y)
167167
p1 = clr1.predict(X)
168168

169-
crit = SimpleRegressorCriterion(X)
169+
crit = SimpleRegressorCriterion(
170+
1 if len(y.shape) <= 1 else y.shape[1], X.shape[0])
170171
clr2 = DecisionTreeRegressor(criterion=crit, max_depth=1)
171172
clr2.fit(X, y)
172173
p2 = clr2.predict(X)
@@ -179,7 +180,9 @@ def test_decision_tree_criterion_iris(self):
179180
clr1 = DecisionTreeRegressor()
180181
clr1.fit(X, y)
181182
p1 = clr1.predict(X)
182-
clr2 = DecisionTreeRegressor(criterion=SimpleRegressorCriterion(X))
183+
clr2 = DecisionTreeRegressor(
184+
criterion=SimpleRegressorCriterion(
185+
1 if len(y.shape) <= 1 else y.shape[1], X.shape[0]))
183186
clr2.fit(X, y)
184187
p2 = clr2.predict(X)
185188
self.assertEqual(p1[:10], p2[:10])

_unittests/ut_mlmodel/test_piecewise_decision_tree_experiment_fast.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_criterions(self):
2727
X = numpy.array([[1., 2.]]).T
2828
y = numpy.array([1., 2.])
2929
c1 = MSE(1, X.shape[0])
30-
c2 = SimpleRegressorCriterionFast(X)
30+
c2 = SimpleRegressorCriterionFast(1, X.shape[0])
3131
self.assertNotEmpty(c1)
3232
self.assertNotEmpty(c2)
3333
w = numpy.ones((y.shape[0],))
@@ -51,7 +51,7 @@ def test_criterions(self):
5151
X = numpy.array([[1., 2., 3.]]).T
5252
y = numpy.array([1., 2., 3.])
5353
c1 = MSE(1, X.shape[0])
54-
c2 = SimpleRegressorCriterionFast(X)
54+
c2 = SimpleRegressorCriterionFast(1, X.shape[0])
5555
w = numpy.ones((y.shape[0],))
5656
ind = numpy.arange(y.shape[0]).astype(numpy.int64)
5757
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -71,7 +71,7 @@ def test_criterions(self):
7171
X = numpy.array([[1., 2., 10., 11.]]).T
7272
y = numpy.array([0.9, 1.1, 1.9, 2.1])
7373
c1 = MSE(1, X.shape[0])
74-
c2 = SimpleRegressorCriterionFast(X)
74+
c2 = SimpleRegressorCriterionFast(1, X.shape[0])
7575
w = numpy.ones((y.shape[0],))
7676
ind = numpy.arange(y.shape[0]).astype(numpy.int64)
7777
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -115,7 +115,7 @@ def test_criterions(self):
115115
X = numpy.array([[1., 2., 10., 11.]]).T
116116
y = numpy.array([0.9, 1.1, 1.9, 2.1])
117117
c1 = MSE(1, X.shape[0])
118-
c2 = SimpleRegressorCriterionFast(X)
118+
c2 = SimpleRegressorCriterionFast(1, X.shape[0])
119119
w = numpy.ones((y.shape[0],))
120120
ind = numpy.array([0, 3, 2, 1], dtype=ind.dtype)
121121
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -162,7 +162,7 @@ def test_decision_tree_criterion(self):
162162
clr1.fit(X, y)
163163
p1 = clr1.predict(X)
164164

165-
crit = SimpleRegressorCriterionFast(X)
165+
crit = SimpleRegressorCriterionFast(1, X.shape[0])
166166
clr2 = DecisionTreeRegressor(criterion=crit, max_depth=1)
167167
clr2.fit(X, y)
168168
p2 = clr2.predict(X)
@@ -175,7 +175,7 @@ def test_decision_tree_criterion_iris(self):
175175
clr1 = DecisionTreeRegressor()
176176
clr1.fit(X, y)
177177
p1 = clr1.predict(X)
178-
clr2 = DecisionTreeRegressor(criterion=SimpleRegressorCriterionFast(X))
178+
clr2 = DecisionTreeRegressor(criterion=SimpleRegressorCriterionFast(1, X.shape[0]))
179179
clr2.fit(X, y)
180180
p2 = clr2.predict(X)
181181
self.assertEqual(p1[:10], p2[:10])

_unittests/ut_mlmodel/test_piecewise_decision_tree_experiment_linear.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_criterions(self):
2525
X = numpy.array([[10., 12., 13.]]).T
2626
y = numpy.array([20., 22., 23.])
2727
c1 = MSE(1, X.shape[0])
28-
c2 = LinearRegressorCriterion(X)
28+
c2 = LinearRegressorCriterion(1, X)
2929
self.assertNotEmpty(c1)
3030
self.assertNotEmpty(c2)
3131
w = numpy.ones((y.shape[0],))
@@ -49,7 +49,7 @@ def test_criterions(self):
4949
X = numpy.array([[1., 2., 3.]]).T
5050
y = numpy.array([1., 2., 3.])
5151
c1 = MSE(1, X.shape[0])
52-
c2 = LinearRegressorCriterion(X)
52+
c2 = LinearRegressorCriterion(1, X)
5353
w = numpy.ones((y.shape[0],))
5454
ind = numpy.arange(y.shape[0]).astype(numpy.int64)
5555
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -68,7 +68,7 @@ def test_criterions(self):
6868
X = numpy.array([[1., 2., 10., 11.]]).T
6969
y = numpy.array([0.9, 1.1, 1.9, 2.1])
7070
c1 = MSE(1, X.shape[0])
71-
c2 = LinearRegressorCriterion(X)
71+
c2 = LinearRegressorCriterion(1, X)
7272
w = numpy.ones((y.shape[0],))
7373
ind = numpy.arange(y.shape[0]).astype(numpy.int64)
7474
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -87,7 +87,7 @@ def test_criterions(self):
8787
X = numpy.array([[1., 2., 10., 11.]]).T
8888
y = numpy.array([0.9, 1.1, 1.9, 2.1])
8989
c1 = MSE(1, X.shape[0])
90-
c2 = LinearRegressorCriterion(X)
90+
c2 = LinearRegressorCriterion(1, X)
9191
w = numpy.ones((y.shape[0],))
9292
ind = numpy.array([0, 3, 2, 1], dtype=ind.dtype)
9393
ys = y.astype(float).reshape((y.shape[0], 1))
@@ -145,7 +145,7 @@ def test_decision_tree_criterion(self):
145145
clr1.fit(X, y)
146146
p1 = clr1.predict(X)
147147

148-
crit = LinearRegressorCriterion(X)
148+
crit = LinearRegressorCriterion(1, X)
149149
clr2 = DecisionTreeRegressor(criterion=crit, max_depth=1)
150150
clr2.fit(X, y)
151151
p2 = clr2.predict(X)
@@ -158,7 +158,7 @@ def test_decision_tree_criterion_iris(self):
158158
clr1 = DecisionTreeRegressor()
159159
clr1.fit(X, y)
160160
p1 = clr1.predict(X)
161-
clr2 = DecisionTreeRegressor(criterion=LinearRegressorCriterion(X))
161+
clr2 = DecisionTreeRegressor(criterion=LinearRegressorCriterion(1, X))
162162
clr2.fit(X, y)
163163
p2 = clr2.predict(X)
164164
self.assertEqual(p1.shape, p2.shape)

_unittests/ut_timeseries/test_plot_timeseries.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"""
44
import unittest
55
import datetime
6+
import warnings
7+
import sys
68
from pyquickhelper.pycode import ExtTestCase
79
from mlinsights.timeseries.datasets import artificial_data
810
from mlinsights.timeseries.agg import aggregate_timeseries
@@ -11,8 +13,17 @@
1113

1214
class TestPlotTimeSeries(ExtTestCase):
1315

16+
@unittest.skipIf(
17+
sys.platform == "win32" and __name__ != "__main__",
18+
reason="issue with matplotlib")
1419
def test_plot_data(self):
15-
import matplotlib.pyplot as plt # pylint: disable=C0415
20+
try:
21+
import matplotlib.pyplot as plt # pylint: disable=C0415
22+
except Exception as e:
23+
if 'generated new fontManager' in str(e):
24+
warnings.warn(e)
25+
return
26+
raise e
1627
dt1 = datetime.datetime(2019, 8, 1)
1728
dt2 = datetime.datetime(2019, 8, 15)
1829
data = artificial_data(dt1, dt2, minutes=15)

appveyor.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ environment:
1010
PYTHON_VERSION: "3.9.x"
1111
PYTHON_ARCH: "64"
1212
SKL: '==0.24.2'
13-
- PYTHON: "C:\\Python38-x64"
14-
PYTHON_VERSION: "3.8.x"
15-
PYTHON_ARCH: "64"
16-
SKL: '==0.23.2'
1713
init:
1814
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
1915

azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
displayName: 'Install Inkscape'
1919
- script: sudo apt-get install -y pandoc
2020
displayName: 'Install Pandoc'
21-
- script: sudo apt-get install -y texlive texlive-latex-extra texlive-xetex dvipng
22-
displayName: 'Install Latex'
21+
# - script: sudo apt-get install -y texlive texlive-latex-extra texlive-xetex dvipng
22+
# displayName: 'Install Latex'
2323
- script: sudo apt-get install -y libgeos-dev libproj-dev proj-data graphviz libblas-dev liblapack-dev
2424
displayName: 'Install Geos packages'
2525
- script: |
@@ -37,7 +37,7 @@ jobs:
3737
displayName: 'Install tools'
3838
- script: pip install numpy
3939
displayName: 'Install numpy'
40-
- script: pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
40+
- script: pip install install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
4141
displayName: 'Install pytorch'
4242
- script: |
4343
export LLVM_CONFIG=/usr/bin/llvm-config-10

0 commit comments

Comments
 (0)