Exemple #1
0
obj_func_name = str(argv[0])
method = str(argv[1])
num_to_sample = int(argv[2])
job_id = int(argv[3])

# constants
num_func_eval = 100
num_iteration = int(num_func_eval / num_to_sample) + 1

obj_func_dict = {
    'Branin': synthetic_functions.Branin(),
    'Rosenbrock': synthetic_functions.Rosenbrock(),
    'Hartmann3': synthetic_functions.Hartmann3(),
    'Levy4': synthetic_functions.Levy4(),
    'Hartmann6': synthetic_functions.Hartmann6(),
    'Ackley': synthetic_functions.Ackley()
}
#'CIFAR10': real_functions.CIFAR10(),
#'KISSGP': real_functions.KISSGP()}

objective_func = obj_func_dict[obj_func_name]
dim = int(objective_func._dim)
num_initial_points = int(objective_func._num_init_pts)

num_fidelity = objective_func._num_fidelity

inner_search_domain = pythonTensorProductDomain([
    ClosedInterval(objective_func._search_domain[i, 0],
                   objective_func._search_domain[i, 1])
    for i in xrange(objective_func._search_domain.shape[0] - num_fidelity)
])
Exemple #2
0
num_to_sample = int(argv[1])
num_func_eval_dict = {"Branin": 60, "LG": 60, "Hartmann": 60, "Ackley": 100, "Rosenbrock": 100, "Levy": 60, "GP": 10, "GP_wavy" : 10}
num_iteration = int(num_func_eval_dict[obj_func_name] / num_to_sample) + 1
lhc_search_itr = int(argv[2])

start_idx = int(argv[3])
end_idx = int(argv[4])
figwidth = int(argv[5])
figheight = int(argv[6])

# constants
a=numpy.random.normal(0,1)
theta=10*numpy.random.multivariate_normal(numpy.zeros(6), numpy.identity(6))
obj_func_dict = {'Branin': synthetic_functions.Branin(),
                 'Hartmann': synthetic_functions.Hartmann3(), 'Rosenbrock': synthetic_functions.Rosenbrock(),
                 'Ackley': synthetic_functions.Ackley(), 'Levy': synthetic_functions.Levy()}
cpp_sgd_params = cppGradientDescentParameters(num_multistarts=2000, max_num_steps=20, max_num_restarts=1,
                                              num_steps_averaged=15, gamma=0.7, pre_mult=1.0,
                                              max_relative_change=0.7, tolerance=1.0e-3)

if obj_func_name == "GP":
    gp_grad_info_dict = pickle.load(open('random_gp_grad_1d', 'rb'))
    hist_data_grad = HistoricalData(gp_grad_info_dict['dim'], 1)
    hist_data_grad.append_historical_data(gp_grad_info_dict['points'], gp_grad_info_dict['values'], gp_grad_info_dict['vars'])
    objective_func = synthetic_functions.RandomGP(gp_grad_info_dict['dim'], gp_grad_info_dict['hyper_params'], hist_data_grad)
    hyper_params = gp_grad_info_dict['hyper_params']
    init_pts = [[-1.5], [-1.0], [1.0], [1.5]]
    ymax = 2
elif obj_func_name == "GP_wavy":
    gp_grad_info_dict = pickle.load(open('random_gp_1d_wavy', 'rb'))
    hist_data_grad = HistoricalData(gp_grad_info_dict['dim'], 0)