rf_bo = BayesianOptimization(rf_cv,
{
'alpha1':(0.001,0.01)
})
from bayes_opt import UtilityFunction
utility = UtilityFunction(kind="ucb",kappa=2.5,xi=0.0)
next_point_to_probe = rf_bo.suggest(utility)
print("Next point to probe is:", next_point_to_probe)
target = rf_cv(**next_point_to_probe)
print("Found the target value to be:", target)
if_bo.register(params=next_point_to_probe,target=target)
#最大化循环
for _ in range(200):
next_point = rf_bo.suggest(utility)
target = rf_cv(**next_point)
rf_bo.register(params=next_point,target=target)
print(next_point,target,"第",_+1,"代")
print(rf_bo.max)