-
Notifications
You must be signed in to change notification settings - Fork 554
Fix numpy Deprecation errors #1023
Conversation
skopt/space/space.py
Outdated
| Name associated with the dimension, e.g., "learning rate". | ||
| dtype : str or dtype, default=np.float | ||
| dtype : str or dtype, default=np.float64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just float, since that's what the user will become accustomed to seeing?
skopt/space/space.py
Outdated
| elif isinstance(self.dtype, type) and self.dtype\ | ||
| not in [float, np.float, np.float16, np.float32, np.float64]: | ||
| raise ValueError("dtype must be float, np.float" | ||
| not in [float, np.float16, np.float32, np.float64]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd promote the condition to:
np.issubdtype(self.dtype, np.floating)or something equivalent.
|
Hello @xmatthias! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-21 14:29:31 UTC |
6f9f84b to
1bcd619
Compare
1bcd619 to
277aac5
Compare
skopt/space/space.py
Outdated
| raise ValueError("dtype must be float, np.float" | ||
| elif isinstance(self.dtype, type) and \ | ||
| np.issubdtype(type(self.dtype), np.floating): | ||
| raise ValueError("dtype must be float, np.float64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match the previous check, the condition should probably be negated, though. 😄
Can you also amend the error string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sure, sorry for the long back and forth!
This will fix some numpy depreciation errors that appear due to the usage of float.
It's also fixing
skopt/learning/gaussian_process/kernels.py:319: DeprecationWarning: invalid escape sequence \s- although i'm not 100% certain how this fix will come out at the docs.Unfortunately, i'm uncertain how to build / verify this - as it doesn't seem to be documented.
I'm hoping that CI passes, as i found no way to get
skopt/tests/test_gp_opt.pyto pass all tests (not with master, not with the modifications ...).