Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): replace np.float_ to np.float64 #1119

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading