def compute_EI(ni, alpha, lr, lr_time, X, y, ei_xi, x):
var = np.var(lr.predict(X) - y)
m = np.dot(X.T, X)
inv = np.linalg.inv(m + alpha * np.eye(sum(ni)))
x_flat = np.array(x)
mu_x = lr.predict([x_flat])
var_x = var * (1 + np.dot(np.dot(x_flat, inv), x_flat.T))
sigma_x = np.sqrt(var_x)
u = (np.min(y) - ei_xi - mu_x) / sigma_x
EI = sigma_x * (u*norm.cdf(u) + norm.pdf(u))
estimated_time = lr_time.predict([x_flat])[0]
EIPS = EI / estimated_time
return EIPS
评论列表
文章目录