Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Bug Latin Hypercube sampling #1165

Open
MaAl13 opened this issue May 12, 2023 · 0 comments
Open

Bug Latin Hypercube sampling #1165

MaAl13 opened this issue May 12, 2023 · 0 comments

Comments

@MaAl13
Copy link

MaAl13 commented May 12, 2023

If i run the Latin Hypercube sampling with the basic lines of code:

from skopt.sampler import Lhs
from skopt.space import Space
space = Space([(1,2),(3,4)])
lhs = Lhs(criterion="maximin", iterations=10000)
initial_population = lhs.generate(space.dimensions, 5)

I run into the error

Traceback (most recent call last):
File "", line 1, in
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/skopt/sampler/lhs.py", line 89, in generate
h_opt = space.inverse_transform(h_opt)
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/skopt/space/space.py", line 999, in inverse_transform
columns.append(dim.inverse_transform(Xt[:, start]))
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/skopt/space/space.py", line 528, in inverse_transform
inv_transform = super(Integer, self).inverse_transform(Xt)
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/skopt/space/space.py", line 168, in inverse_transform
return self.transformer.inverse_transform(Xt)
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/skopt/space/transformers.py", line 309, in inverse_transform
X = transformer.inverse_transform(X)
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/skopt/space/transformers.py", line 275, in inverse_transform
return np.round(X_orig).astype(np.int)
File "/Users/malmansto/anaconda3/envs/fem-cycle-model/lib/python3.10/site-packages/numpy/init.py", line 305, in getattr
# raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'inf'?

This is fixed when commenting out 197 - 321 in the init.py file. Maybe you can fix that

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant