The code
def objective(x, x_int=5):
return x_int + sum(x)
# Use gp_minimize to find the minimum of the objective function
dims = [(0., 20.)]
res = gp_minimize(objective, dimensions=dims)
# Print the best set of parameters
print(f"Best set of parameters: {res.x}")
works but the code
def objective(x, x_int=5):
return x_int + sum(x)
# Use gp_minimize to find the minimum of the objective function
dims = [(0, 20)]
res = gp_minimize(objective, dimensions=dims)
# Print the best set of parameters
print(f"Best set of parameters: {res.x}")
gives the following error
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.
How can I create an optimizer for integer values?
The Bing chatbot suggests that I could downgrade my version of numpy to a version less than 1.24. It's true that I am on Numpy version 1.26.3. Do I need to downgrade to fix this?