MCPcopy Create free account
hub / github.com/modAL-python/modAL / optimizer_PI

Function optimizer_PI

modAL/acquisition.py:35–53  ·  view source on GitHub ↗

Probability of improvement acquisition function for Bayesian optimization. Args: optimizer: The :class:`~modAL.models.BayesianOptimizer` object for which the utility is to be calculated. X: The samples for which the probability of improvement is to be calculated. tr

(optimizer: BaseLearner, X: modALinput, tradeoff: float = 0)

Source from the content-addressed store, hash-verified

33
34
35def optimizer_PI(optimizer: BaseLearner, X: modALinput, tradeoff: float = 0) -> np.ndarray:
36 """
37 Probability of improvement acquisition function for Bayesian optimization.
38
39 Args:
40 optimizer: The :class:`~modAL.models.BayesianOptimizer` object for which the utility is to be calculated.
41 X: The samples for which the probability of improvement is to be calculated.
42 tradeoff: Value controlling the tradeoff parameter.
43
44 Returns:
45 Probability of improvement utility score.
46 """
47 try:
48 mean, std = optimizer.predict(X, return_std=True)
49 mean, std = mean.reshape(-1, ), std.reshape(-1, )
50 except NotFittedError:
51 mean, std = np.zeros(shape=(X.shape[0], 1)), np.ones(shape=(X.shape[0], 1))
52
53 return PI(mean, std, optimizer.y_max, tradeoff)
54
55
56def optimizer_EI(optimizer: BaseLearner, X: modALinput, tradeoff: float = 0) -> np.ndarray:

Callers 1

max_PIFunction · 0.85

Calls 2

PIFunction · 0.85
predictMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…