Skip to content

Commit f42e93e

Browse files
authored
Update style and fix compilation issues with the latest numpy/scikit-learn (#128)
* update style * remove unused file * rename SIZE_t into intp_t * update requirements * fix missing dependency * remove unused print
1 parent 56fb2dc commit f42e93e

22 files changed

+94
-96
lines changed

_doc/examples/plot_constraint_kmeans.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Data
1111
====
1212
"""
13+
1314
from collections import Counter
1415

1516
import matplotlib.pyplot as plt

_doc/examples/plot_decision_tree_logreg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
models on the `Iris
1414
dataset <https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html>`_.
1515
"""
16+
1617
import numpy
1718
from scipy.spatial.distance import cdist
1819
import matplotlib.pyplot as plt

_doc/examples/plot_digitize.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Simple example
1414
==============
1515
"""
16+
1617
import numpy
1718
import matplotlib.pyplot as plt
1819
from onnxruntime import InferenceSession

_doc/examples/plot_kmeans_l1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
algorithm.
99
"""
1010

11-
1211
import matplotlib.pyplot as plt
1312
import numpy
1413
import numpy.random as rnd

_doc/examples/plot_leave_neighbors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
the predict the same value (or class). Do they share a border?
88
"""
99

10-
1110
##############################
1211
# A simple tree
1312
# +++++++++++++

_doc/examples/plot_logistic_regression_clustering.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
-------------------------------
1414
"""
1515

16-
1716
import numpy
1817
import pandas
1918
import matplotlib.pyplot as plt

_doc/examples/plot_piecewise_linear_regression_criterion.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Let's build a toy problem based on two linear models.
1818
"""
1919

20-
2120
import matplotlib.pyplot as plt
2221
import numpy
2322
import numpy.random as npr
@@ -154,7 +153,7 @@
154153
#
155154
# ctypedef double float64_t
156155
#
157-
# cdef void _mean(self, SIZE_t start, SIZE_t end, float64_t *mean,
156+
# cdef void _mean(self, intp_t start, intp_t end, float64_t *mean,
158157
# float64_t *weight) nogil:
159158
# if start == end:
160159
# mean[0] = 0.
@@ -168,7 +167,7 @@
168167
# weight[0] = w
169168
# mean[0] = 0. if w == 0. else m / w
170169
#
171-
# cdef float64_t _mse(self, SIZE_t start, SIZE_t end, float64_t mean,
170+
# cdef float64_t _mse(self, intp_t start, intp_t end, float64_t mean,
172171
# float64_t weight) nogil:
173172
# if start == end:
174173
# return 0.
@@ -193,7 +192,7 @@
193192
#
194193
# ctypedef double float64_t
195194
#
196-
# cdef void _mean(self, SIZE_t start, SIZE_t end, float64_t *mean,
195+
# cdef void _mean(self, intp_t start, intp_t end, float64_t *mean,
197196
# float64_t *weight) nogil:
198197
# if start == end:
199198
# mean[0] = 0.
@@ -205,7 +204,7 @@
205204
# weight[0] = w
206205
# mean[0] = 0. if w == 0. else m / w
207206
#
208-
# cdef float64_t _mse(self, SIZE_t start, SIZE_t end, float64_t mean,
207+
# cdef float64_t _mse(self, intp_t start, intp_t end, float64_t mean,
209208
# float64_t weight) nogil:
210209
# if start == end:
211210
# return 0.

_doc/examples/plot_quantile_mlpregression.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
We first generate some dummy data.
1212
"""
1313

14-
1514
import numpy
1615
from pandas import DataFrame
1716
import matplotlib.pyplot as plt

_doc/examples/plot_traceable_ngrams_tfidf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
~~~~~~~~~~~~~~~~~~~~
1616
"""
1717

18-
1918
import numpy
2019
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
2120
from mlinsights.mlmodel.sklearn_text import (

_unittests/ut_mlmodel/test_piecewise_decision_tree_experiment_linear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ def test_criterions_check_value(self):
140140
X = numpy.array([[10.0, 12.0, 13.0]]).T
141141
y = numpy.array([[20.0, 22.0, 23.0]]).T
142142
c2 = LinearRegressorCriterion.create(X, y)
143-
coef = numpy.empty((3,))
143+
coef = numpy.empty((3,), dtype=X.dtype)
144144
c2.node_beta(coef)
145-
self.assertEqual(coef[:2], numpy.array([1, 10]))
145+
self.assertEqualArray(coef[:2], numpy.array([1, 10], dtype=X.dtype), atol=1e-8)
146146

147147
@unittest.skipIf(
148148
pv.Version(skl_ver) < pv.Version("1.3.3"),

0 commit comments

Comments
 (0)