···
1
-
From 360cb75317aecaf6b9abcf24f0577afef75c464e Mon Sep 17 00:00:00 2001
2
-
From: wxt <3264117476@qq.com>
3
-
Date: Mon, 6 Jan 2025 20:41:27 +0800
4
-
Subject: [PATCH] fix(test): replace np.float_ to np.float64
7
-
mlxtend/_base/_regressor.py | 2 +-
8
-
mlxtend/_base/tests/test_classifier.py | 2 +-
9
-
mlxtend/_base/tests/test_cluster.py | 2 +-
10
-
mlxtend/classifier/multilayerperceptron.py | 2 +-
11
-
mlxtend/classifier/softmax_regression.py | 2 +-
12
-
mlxtend/math/linalg.py | 2 +-
13
-
mlxtend/plotting/tests/test_decision_regions.py | 2 +-
14
-
7 files changed, 7 insertions(+), 7 deletions(-)
16
-
diff --git a/mlxtend/_base/_regressor.py b/mlxtend/_base/_regressor.py
17
-
index e3d0a1d..1d3a5d6 100644
18
-
--- a/mlxtend/_base/_regressor.py
19
-
+++ b/mlxtend/_base/_regressor.py
20
-
@@ -16,7 +16,7 @@ class _Regressor(object):
23
-
def _check_target_array(self, y, allowed=None):
24
-
- if not isinstance(y[0], (float, np.float_)):
25
-
+ if not isinstance(y[0], (float, np.float64)):
26
-
raise AttributeError("y must be a float array.\nFound %s" % y.dtype)
28
-
def fit(self, X, y, init_params=True):
29
-
diff --git a/mlxtend/_base/tests/test_classifier.py b/mlxtend/_base/tests/test_classifier.py
30
-
index f77f74d..1bbac6d 100644
31
-
--- a/mlxtend/_base/tests/test_classifier.py
32
-
+++ b/mlxtend/_base/tests/test_classifier.py
33
-
@@ -51,7 +51,7 @@ def test_check_labels_not_ok_1():
36
-
def test_check_labels_integer_notok():
37
-
- y = np.array([1.0, 2.0], dtype=np.float_)
38
-
+ y = np.array([1.0, 2.0], dtype=np.float64)
39
-
cl = BlankClassifier(print_progress=0, random_seed=1)
40
-
with pytest.raises(AttributeError) as excinfo:
41
-
cl._check_target_array(y)
42
-
diff --git a/mlxtend/_base/tests/test_cluster.py b/mlxtend/_base/tests/test_cluster.py
43
-
index 6da1a9d..54c2526 100644
44
-
--- a/mlxtend/_base/tests/test_cluster.py
45
-
+++ b/mlxtend/_base/tests/test_cluster.py
46
-
@@ -51,7 +51,7 @@ def test_check_labels_not_ok_1():
49
-
def test_check_labels_integer_notok():
50
-
- y = np.array([1.0, 2.0], dtype=np.float_)
51
-
+ y = np.array([1.0, 2.0], dtype=np.float64)
52
-
cl = BlankClassifier(print_progress=0, random_seed=1)
53
-
with pytest.raises(AttributeError) as excinfo:
54
-
cl._check_target_array(y)
55
-
diff --git a/mlxtend/classifier/multilayerperceptron.py b/mlxtend/classifier/multilayerperceptron.py
56
-
index 770dab9..05416c3 100644
57
-
--- a/mlxtend/classifier/multilayerperceptron.py
58
-
+++ b/mlxtend/classifier/multilayerperceptron.py
59
-
@@ -143,7 +143,7 @@ class MultiLayerPerceptron(
60
-
prev_grad_b_out = np.zeros(shape=self.b_["out"].shape)
61
-
prev_grad_w_out = np.zeros(shape=self.w_["out"].shape)
63
-
- y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float_)
64
-
+ y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float64)
66
-
self.init_time_ = time()
68
-
diff --git a/mlxtend/classifier/softmax_regression.py b/mlxtend/classifier/softmax_regression.py
69
-
index 56444e5..173154e 100644
70
-
--- a/mlxtend/classifier/softmax_regression.py
71
-
+++ b/mlxtend/classifier/softmax_regression.py
72
-
@@ -141,7 +141,7 @@ class SoftmaxRegression(_BaseModel, _IterativeModel, _Classifier, _MultiClass):
76
-
- y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float_)
77
-
+ y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float64)
79
-
self.init_time_ = time()
80
-
rgen = np.random.RandomState(self.random_seed)
81
-
diff --git a/mlxtend/math/linalg.py b/mlxtend/math/linalg.py
82
-
index 02600f1..ece4c3c 100644
83
-
--- a/mlxtend/math/linalg.py
84
-
+++ b/mlxtend/math/linalg.py
85
-
@@ -45,7 +45,7 @@ def vectorspace_orthonormalization(ary, eps=1e-13): # method='gram-schmidt',
86
-
# 2c) Normalize if linearly independent,
87
-
# and set to zero otherwise
89
-
- arr = ary.astype(np.float_).copy()
90
-
+ arr = ary.astype(np.float64).copy()
92
-
for i in range(arr.shape[1]):
94
-
diff --git a/mlxtend/plotting/tests/test_decision_regions.py b/mlxtend/plotting/tests/test_decision_regions.py
95
-
index fba2255..aad63ff 100644
96
-
--- a/mlxtend/plotting/tests/test_decision_regions.py
97
-
+++ b/mlxtend/plotting/tests/test_decision_regions.py
98
-
@@ -94,7 +94,7 @@ def test_y_int_ary():
99
-
"Try passing the array as y.astype(np.int_)",
100
-
plot_decision_regions,
102
-
- y.astype(np.float_),
103
-
+ y.astype(np.float64),