Gradient-Free-Optimizers
Gradient-Free-Optimizers copied to clipboard
add support to maximize and minimize objective-function
This new parameter would determine if the optimum the algorithm is searching for is the minimum or maximum of the objective-function. The API for this could look as follows:
import numpy as np
from gradient_free_optimizers import RandomSearchOptimizer
def parabola_function(para):
loss = para["x"] * para["x"]
return -loss
search_space = {"x": np.arange(-10, 10, 0.1)}
opt = RandomSearchOptimizer(search_space, optimum="minimum")
opt.search(parabola_function, n_iter=100000)
opt = RandomSearchOptimizer(search_space, optimum="maximum")
opt.search(parabola_function, n_iter=100000)