MOE
MOE copied to clipboard
[Python] analytic "qd" EI and 1-EI eat NaNs
_compute_expected_improvement_qd_analytic
and _compute_expected_improvement_1d_analytic
both finish by calling numpy.fmax
. If either argument to fmax is NaN, it returns the non-NaN arg:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.fmax.html#numpy.fmax
numpy.maximum propagates nans; we may want that instead. I'm not sure it's possible for 1d_analytic to produce NaNs anymore, but qd_analytic definitely can (when var_star is nearly singular).
It's unclear that the behavior we'd want in these numerically unsafe situations is to output 0.0 (vs propagating the NaN out as an error or trying to deal w/the precision issues)
here's one request for kriging that generates NaNs:
{"domain_info": {"dim": 1, "domain_bounds": [{"max": 1.0, "min": 0.0}]}, "gp_historical_info": {"points_sampled": [{"value_var": 1.0e-12, "value": 0.1, "point": [0.0]}, {"value_var": 1.0e-12, "value": 0.2, "point": [1.0]}]}, "kriging_noise_variance": 1e-12, "std_deviation_coef": 0.1, "num_to_sample": 16}
this is not a particularly "nice" request insofar as we have 2 historical points and we're requesting num_to_sample = 16. I've run across some less goofy examples; I'll try to pull them up later.