Skip to content

Commit

Permalink
fix(test): replace np.float_ to np.float64
Browse files Browse the repository at this point in the history
  • Loading branch information
Bot-wxt1221 committed Jan 6, 2025
1 parent 9f0bc8f commit 360cb75
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mlxtend/_base/_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion mlxtend/_base/tests/test_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mlxtend/_base/tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mlxtend/classifier/multilayerperceptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _fit(self, X, y, init_params=True):
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()

Expand Down
2 changes: 1 addition & 1 deletion mlxtend/classifier/softmax_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _fit(self, X, y, init_params=True):
)
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)
Expand Down
2 changes: 1 addition & 1 deletion mlxtend/math/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion mlxtend/plotting/tests/test_decision_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down

0 comments on commit 360cb75

Please sign in to comment.