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

Parameter type checking #996

Closed
bernardo-suez opened this issue Jun 7, 2022 · 3 comments
Closed

Parameter type checking #996

bernardo-suez opened this issue Jun 7, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request wishlist Long-term wishlist feature requests

Comments

@bernardo-suez
Copy link

Function _get_parameter_type in line 117 of instantiation.py throws error No AE parameter type corresponding to <class 'numpy.float64'>. if the bounds of a range variable are calculated outside Ax using some Numpy function, which will return numpy.float64 as opposed to a Python float.

If possible, given how ubiquitous Numpy is, either (1) allowing Numpy primitives or (2) suggesting casting in the error message will make it easier for users to debug their application. It may be just me (I was not a CS major), but I couldn't figure out that a simple casting would solve the problem until digging into Ax's code with the debugger.

@mpolson64 mpolson64 self-assigned this Jun 7, 2022
@mpolson64
Copy link
Contributor

Thank you for bringing this to our attention, and I'm happy you were able to unblock yourself!
What you're suggesting does not sound unreasonable to me; numpy (and torch) floats can almost always be safely casted here. I will raise it with the team here and hear what they have to say :)

@berkgercek
Copy link

Also will chime in and say this is important for my workflow as well. Manually casting to a python native float adds a lot of obfuscation to my call to ax.optimize

@lena-kashtelyan lena-kashtelyan added the enhancement New feature or request label Jun 13, 2022
@lena-kashtelyan lena-kashtelyan added the wishlist Long-term wishlist feature requests label Sep 13, 2022
@lena-kashtelyan
Copy link
Contributor

I'm going to put this onto the wishlist, as property handling the numpy types is not actually entirely trivial to add in Ax, as there are a lot of places this will need to be handled. For now, please ensure you coerce your numpy values to Python primitives before passing them to Ax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wishlist Long-term wishlist feature requests
Projects
None yet
Development

No branches or pull requests

4 participants