Closed 23pointsNorth closed 2 years ago
Hello @23pointsNorth,
nice find! I did not know this limitation of numpy.
However it seems, that this issue is related or a duplicate of issue SimonBlanke/Gradient-Free-Optimizers#1, because of this line:
pos_mesh = np.array(np.meshgrid(*positions))
The bug is caused by the calculation of the initial positions as vertices and grids in the search space. I initialized with random
and the code runs fine:
import numpy as np
from gradient_free_optimizers import RandomSearchOptimizer
def parabola_function(para):
loss = para["x0"] * para["x0"]
return -loss
search_dim = 50
search_space = {f"x{i}": np.arange(-10, 10, 1) for i in range(search_dim)}
print(search_space)
opt = RandomSearchOptimizer(search_space, initialize={"random": 4})
opt.search(parabola_function, n_iter=10)
I will close this issue for now. If the numpy-limit becomes a problem for GFO we can reopen it.
Thanks for the help! :-)
Just wanted to confirm that your suggestion fixed the issue. Thanks for the quick response!
@23pointsNorth
very nice! I just rolled out v1.0.5, which has a fix/workaround for the "vertices"- and "grid"-initializations.
Describe the bug When building large search spaces over dimensionality of 32, a numpy limit is reached.
Code to reproduce the behavior
Error message from command line
System information:
Additional context