Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicted integer parameter out of bounds #86

Open
ThrivikramanV opened this issue Feb 20, 2023 · 0 comments
Open

Predicted integer parameter out of bounds #86

ThrivikramanV opened this issue Feb 20, 2023 · 0 comments

Comments

@ThrivikramanV
Copy link

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

samples = np.round(X_copy * self.get_size() - 0.5 + self.get_min()).astype(int)

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.around

Potential solution

If line 448 is modified to the following, would it resolve the issue?

samples = np.round(X_copy * (self.get_size() - 1) + self.get_min()).astype(int)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant