def test_acq_with_poi(): util = UtilityFunction(kind="poi", kappa=1.0, xi=1e-4) episilon = 1e-2 y_max = 2.0 max_arg = acq_max( util.utility, GP, y_max, bounds=np.array([[0, 1], [0, 1]]), random_state=ensure_rng(0), n_iter=200, ) _, brute_max_arg = brute_force_maximum(MESH, GP, kind='poi', kappa=1.0, xi=1e-4) assert all(abs(brute_max_arg - max_arg) < episilon)
def test_acq_with_ucb(): util = UtilityFunction(kind="ucb", kappa=1.0, xi=1.0) episilon = 1e-2 y_max = 2.0 max_arg = acq_max(util.utility, GP, y_max, bounds=np.array([[0, 1], [0, 1]]), btypes=[float, float], random_state=ensure_rng(0), n_iter=20) _, brute_max_arg = brute_force_maximum(MESH, GP, kind='ucb', kappa=1.0, xi=1.0) assert all(abs(brute_max_arg - max_arg) < episilon)