24 from bayesoptmodule
import BayesOptContinuous
27 from time
import clock
30 if hasattr(__builtins__,
'raw_input'):
37 total = total + (value - 0.33) * (value - 0.33)
43 def evaluateSample(self,Xin):
52 params[
'n_iterations'] = 50
53 params[
'n_iter_relearn'] = 5
54 params[
'n_init_samples'] = 2
56 print(
"Callback implementation")
63 mvalue, x_out, error = bayesopt.optimize(testfunc, n, lb, ub, params)
65 print(
"Result", mvalue,
"at", x_out)
66 print(
"Running time:", clock() - start,
"seconds")
67 input(
'Press INTRO to continue')
69 print(
"OO implementation")
71 bo_test.parameters = params
72 bo_test.lower_bound = lb
73 bo_test.upper_bound = ub
76 mvalue, x_out, error = bo_test.optimize()
78 print(
"Result", mvalue,
"at", x_out)
79 print(
"Running time:", clock() - start,
"seconds")
80 input(
'Press INTRO to continue')
82 print(
"Callback discrete implementation")
83 x_set = np.random.rand(100, n)
86 mvalue, x_out, error = bayesopt.optimize_discrete(testfunc, x_set, params)
88 print(
"Result", mvalue,
"at", x_out)
89 print(
"Running time:", clock() - start,
"seconds")
91 value = np.array([testfunc(i)
for i
in x_set])
92 print(
"Optimum", value.min(),
"at", x_set[value.argmin()])
Python Module for BayesOptContinuous.