Esempio n. 1
0
eval_pts = inner_search_domain.generate_uniform_random_points_in_domain(int(1e3))
eval_pts = np.reshape(
    np.append(
        eval_pts,
        (cpp_gp_loglikelihood.get_historical_data_copy()).points_sampled[
            :, : (cpp_gp_loglikelihood.dim - objective_func._num_fidelity)
        ],
    ),
    (
        eval_pts.shape[0] + cpp_gp_loglikelihood._num_sampled,
        cpp_gp_loglikelihood.dim - objective_func._num_fidelity,
    ),
)

test = np.zeros(eval_pts.shape[0])
ps = PosteriorMeanMCMC(cpp_gp_loglikelihood.models, num_fidelity)
for i, pt in enumerate(eval_pts):
    ps.set_current_point(
        pt.reshape((1, cpp_gp_loglikelihood.dim - objective_func._num_fidelity))
    )
    test[i] = -ps.compute_objective_function()
report_point = eval_pts[np.argmin(test)].reshape(
    (1, cpp_gp_loglikelihood.dim - objective_func._num_fidelity)
)

py_repeated_search_domain = RepeatedDomain(num_repeats=1, domain=inner_search_domain)
ps_mean_opt = pyGradientDescentOptimizer(
    py_repeated_search_domain, ps, py_sgd_params_ps
)
report_point = multistart_optimize(ps_mean_opt, report_point, num_multistarts=1)[0]
report_point = report_point.ravel()