1 function [ei, varargout] = nei(query, hyp, inf, mean, cov,...
2 lik, xtr, ytr, params )
3 % NEGEXPIMPROVEMENT Compute the *negative* expected improvement.
5 %
DIRECT will call
this with the query vector as a column, but we want
6 % it to be a row. Make sure we can call it both ways.
8 if (size(query,1) > size(query,2))
12 [ymu, ys2] = gp(hyp, inf, mean, cov, lik, xtr, ytr, query); % predict 15 s = sqrt(ys2); % Predicted std 16 yres = min(ytr) - ymu; % Predicted error 17 ynorm = yres/s; % Normalize error 19 ei = yres * normcdf(ynorm) + s * normpdf(ynorm); 22 % DIRECT search for a minimum, and we want the maximum expected 26 varargout{1} = ymu; varargout{2} = s;