Suppose an element in X_copy has the value 1. Assuming an integer parameter with a min value of 1 and a max value of 15. The predicted value here would be np.round([1] * 15 - 0.5 + 1).astype(int) = np.round([15.5]).astype(int) = [16]
For the example in hand, this translates to np.round(X_copy * 14 + 1).astype(int). The minimum value that this evaluates to is 1, and the maximum value is 15.
Observation
For an integer parameter with a min value of 1 and a max value of 15, HyperMapper predicts a value of 16 in some iterations.
Hypothesis
I believe it is due to an issue in line 448 of
hypermapper/space.py
Suppose an element in X_copy has the value 1. Assuming an integer parameter with a min value of 1 and a max value of 15. The predicted value here would be
np.round([1] * 15 - 0.5 + 1).astype(int) = np.round([15.5]).astype(int) = [16]
np.round rounds 15.5 to 16, since 16 is the nearest even integer (another example would be
np.round([14.5]) = [14.]
). Official documentation - https://numpy.org/doc/1.13/reference/generated/numpy.around.html#numpy.aroundPotential solution
If line 448 is modified to the following, would it resolve the issue?
For the example in hand, this translates to
np.round(X_copy * 14 + 1).astype(int)
. The minimum value that this evaluates to is 1, and the maximum value is 15.