import numpy as np |
import GPy |
import GPyOpt |
|
|
|
X = np.array |
([[6.5, 1.2, 2.4, 3.5], |
|
|
[4.5, 2.4, 2.4, 1.5], |
|
|
[5.5, 1.2, 3.0, 5.5], |
|
|
[5.5, 2.4, 1.2, 3.5], |
|
|
[6.5, 1.8, 3.0, 1.5], |
|
|
[4.5, 1.8, 1.2, 5.5], |
|
|
[5.8, 2.2, 1.9, 3.4], |
|
|
[6.2, 2.5, 1.5, 3.2]]) |
|
Y = -np.array([65, 51, 39, 76, 66, 52, 78, 74])[:, np.newaxis] |
|
|
|
initial_x = X |
initial_y = Y |
|
|
|
bounds = |
[{‘name’: ‘current’, ‘type’: ‘continuous’, ‘domain’: (2,9)}, |
|
{‘name’: ‘Init_molarity’, ‘type’: ‘continuous’, ‘domain’: (0.4,3.2)}, |
|
{‘name’: ‘electrolyte’, ‘type’: ‘continuous’, ‘domain’: (0.6,3.6)}, |
|
{‘name’: ‘time’, ‘type’: ‘continuous’, ‘domain’: (0.5,6.5)}] |
|
|
|
|
|
|
|
|
|
myBopt = GPyOpt.methods.BayesianOptimization(f=None, |
|
|
domain=bounds, |
|
|
X = initial_x, |
|
|
Y = initial_y, |
|
|
acquisition_type=‘EI’, |
|
|
|
|
|
|
|
|
) |
|
|
|
next_x = myBopt.suggest_next_locations() |
print(next_x) |