Ejemplo n.º 1
0
)

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()
report_point = np.concatenate((report_point, np.ones(objective_func._num_fidelity)))

print(
    "best so far in the initial data {0}".format(
        true_value_init[np.argmin(true_value_init[:, 0])][0]
    )
)
capital_so_far = 0.0
start = time.time()
for n in range(num_iteration):
    print(
        method
Ejemplo n.º 2
0
                    (1,
                     cpp_gp_loglikelihood.dim - objective_func._num_fidelity)))
            test[i] = -pvar.compute_objective_function()

        initial_points = np.zeros(
            (20, cpp_gp_loglikelihood.dim - objective_func._num_fidelity))
        indices = np.argsort(test)
        for i in range(20):
            initial_points[i, :] = eval_pts[indices[i]]

        #initial_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)
        pvar_mean_opt = pyGradientDescentOptimizer(py_repeated_search_domain,
                                                   pvar,
                                                   py_sgd_params_acquisition)
        report_point = multistart_optimize(pvar_mean_opt,
                                           initial_points,
                                           num_multistarts=20)[0]

        pvar.set_current_point(
            report_point.reshape(
                (1, cpp_gp_loglikelihood.dim - objective_func._num_fidelity)))
        if -pvar.compute_objective_function() > np.min(test):
            report_point = initial_points[[0]]
        next_points = report_point
        voi = np.nan
    elif method == 'PI':
        eval_pts = inner_search_domain.generate_uniform_random_points_in_domain(
            int(1e3))