Just to make sure I understand correctly, this is the average value of all samples that exceed thresh. This gives a raw value in terms of samples. For the "improvement" part of this aren't we missing a subtraction of the mean of samples or something?

Also seems like a bizarre name, since everything in this module is "numeric". Maybe "empirical EI"?

Finally, why not simply `samples > thresh` in the conditional expression below? One line shorter and (IMHO) clearer what's going on.