import numpy as np |
import GPy |
import GPyOpt |
|
X = np.array |
([[5.5, 2.36, 2.1, 1.1], |
|
|
[2.7, 1.8, 3.3, 2.3], |
|
|
[6.9, 0.68, 2.7, 3.5], |
|
|
[8.3, 2.92, 0.9, 5.9], |
|
|
[4.1, 1.24, 1.5, 4.7], |
|
|
[6.7, 0.77, 2.7, 3.3], |
|
|
[6.5, 1.36, 2.0, 2.2]]) |
|
Y = -np.array([67, 31, 68, 48, 66, 70, 78])[:, 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) |