110 lines
4.4 KiB
Diff
110 lines
4.4 KiB
Diff
From 360cb75317aecaf6b9abcf24f0577afef75c464e Mon Sep 17 00:00:00 2001
|
|
From: wxt <3264117476@qq.com>
|
|
Date: Mon, 6 Jan 2025 20:41:27 +0800
|
|
Subject: [PATCH] fix(test): replace np.float_ to np.float64
|
|
|
|
---
|
|
mlxtend/_base/_regressor.py | 2 +-
|
|
mlxtend/_base/tests/test_classifier.py | 2 +-
|
|
mlxtend/_base/tests/test_cluster.py | 2 +-
|
|
mlxtend/classifier/multilayerperceptron.py | 2 +-
|
|
mlxtend/classifier/softmax_regression.py | 2 +-
|
|
mlxtend/math/linalg.py | 2 +-
|
|
mlxtend/plotting/tests/test_decision_regions.py | 2 +-
|
|
7 files changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/mlxtend/_base/_regressor.py b/mlxtend/_base/_regressor.py
|
|
index e3d0a1d..1d3a5d6 100644
|
|
--- a/mlxtend/_base/_regressor.py
|
|
+++ b/mlxtend/_base/_regressor.py
|
|
@@ -16,7 +16,7 @@ class _Regressor(object):
|
|
pass
|
|
|
|
def _check_target_array(self, y, allowed=None):
|
|
- if not isinstance(y[0], (float, np.float_)):
|
|
+ if not isinstance(y[0], (float, np.float64)):
|
|
raise AttributeError("y must be a float array.\nFound %s" % y.dtype)
|
|
|
|
def fit(self, X, y, init_params=True):
|
|
diff --git a/mlxtend/_base/tests/test_classifier.py b/mlxtend/_base/tests/test_classifier.py
|
|
index f77f74d..1bbac6d 100644
|
|
--- a/mlxtend/_base/tests/test_classifier.py
|
|
+++ b/mlxtend/_base/tests/test_classifier.py
|
|
@@ -51,7 +51,7 @@ def test_check_labels_not_ok_1():
|
|
|
|
|
|
def test_check_labels_integer_notok():
|
|
- y = np.array([1.0, 2.0], dtype=np.float_)
|
|
+ y = np.array([1.0, 2.0], dtype=np.float64)
|
|
cl = BlankClassifier(print_progress=0, random_seed=1)
|
|
with pytest.raises(AttributeError) as excinfo:
|
|
cl._check_target_array(y)
|
|
diff --git a/mlxtend/_base/tests/test_cluster.py b/mlxtend/_base/tests/test_cluster.py
|
|
index 6da1a9d..54c2526 100644
|
|
--- a/mlxtend/_base/tests/test_cluster.py
|
|
+++ b/mlxtend/_base/tests/test_cluster.py
|
|
@@ -51,7 +51,7 @@ def test_check_labels_not_ok_1():
|
|
|
|
|
|
def test_check_labels_integer_notok():
|
|
- y = np.array([1.0, 2.0], dtype=np.float_)
|
|
+ y = np.array([1.0, 2.0], dtype=np.float64)
|
|
cl = BlankClassifier(print_progress=0, random_seed=1)
|
|
with pytest.raises(AttributeError) as excinfo:
|
|
cl._check_target_array(y)
|
|
diff --git a/mlxtend/classifier/multilayerperceptron.py b/mlxtend/classifier/multilayerperceptron.py
|
|
index 770dab9..05416c3 100644
|
|
--- a/mlxtend/classifier/multilayerperceptron.py
|
|
+++ b/mlxtend/classifier/multilayerperceptron.py
|
|
@@ -143,7 +143,7 @@ class MultiLayerPerceptron(
|
|
prev_grad_b_out = np.zeros(shape=self.b_["out"].shape)
|
|
prev_grad_w_out = np.zeros(shape=self.w_["out"].shape)
|
|
|
|
- y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float_)
|
|
+ y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float64)
|
|
|
|
self.init_time_ = time()
|
|
|
|
diff --git a/mlxtend/classifier/softmax_regression.py b/mlxtend/classifier/softmax_regression.py
|
|
index 56444e5..173154e 100644
|
|
--- a/mlxtend/classifier/softmax_regression.py
|
|
+++ b/mlxtend/classifier/softmax_regression.py
|
|
@@ -141,7 +141,7 @@ class SoftmaxRegression(_BaseModel, _IterativeModel, _Classifier, _MultiClass):
|
|
)
|
|
self.cost_ = []
|
|
|
|
- y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float_)
|
|
+ y_enc = self._one_hot(y=y, n_labels=self.n_classes, dtype=np.float64)
|
|
|
|
self.init_time_ = time()
|
|
rgen = np.random.RandomState(self.random_seed)
|
|
diff --git a/mlxtend/math/linalg.py b/mlxtend/math/linalg.py
|
|
index 02600f1..ece4c3c 100644
|
|
--- a/mlxtend/math/linalg.py
|
|
+++ b/mlxtend/math/linalg.py
|
|
@@ -45,7 +45,7 @@ def vectorspace_orthonormalization(ary, eps=1e-13): # method='gram-schmidt',
|
|
# 2c) Normalize if linearly independent,
|
|
# and set to zero otherwise
|
|
|
|
- arr = ary.astype(np.float_).copy()
|
|
+ arr = ary.astype(np.float64).copy()
|
|
|
|
for i in range(arr.shape[1]):
|
|
for j in range(i):
|
|
diff --git a/mlxtend/plotting/tests/test_decision_regions.py b/mlxtend/plotting/tests/test_decision_regions.py
|
|
index fba2255..aad63ff 100644
|
|
--- a/mlxtend/plotting/tests/test_decision_regions.py
|
|
+++ b/mlxtend/plotting/tests/test_decision_regions.py
|
|
@@ -94,7 +94,7 @@ def test_y_int_ary():
|
|
"Try passing the array as y.astype(np.int_)",
|
|
plot_decision_regions,
|
|
X[:, :2],
|
|
- y.astype(np.float_),
|
|
+ y.astype(np.float64),
|
|
sr,
|
|
)
|
|
|
|
--
|
|
2.47.0
|
|
|