| Conditions | 1 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # Author: Simon Blanke |
||
| 26 | def calculate(self, X_sample, Y_sample): |
||
| 27 | mu, sigma = self.surrogate_model.predict(self.position_l, return_std=True) |
||
| 28 | # TODO mu_sample = self.surrogate_model.predict(X_sample) |
||
| 29 | mu = mu.reshape(-1, 1) |
||
| 30 | sigma = sigma.reshape(-1, 1) |
||
| 31 | |||
| 32 | # with normalization this is always 1 |
||
| 33 | Y_sample = normalize(np.array(Y_sample)).reshape(-1, 1) |
||
| 34 | |||
| 35 | imp = mu - np.max(Y_sample) - self.xi |
||
| 36 | Z = np.divide(imp, sigma, out=np.zeros_like(sigma), where=sigma != 0) |
||
| 37 | |||
| 38 | exploit = imp * norm.cdf(Z) |
||
| 39 | explore = sigma * norm.pdf(Z) |
||
| 40 | |||
| 41 | aqu_func = exploit + explore |
||
| 42 | aqu_func[sigma == 0.0] = 0.0 |
||
| 43 | |||
| 44 | return aqu_func[:, 0] |
||
| 45 |