-
Notifications
You must be signed in to change notification settings - Fork 143
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
[MNT] Make aeon numpy compatible with both =>2.0 and <2.0 #2216
Conversation
Thank you for contributing to
|
ok so isolated another weird difference arising in the test function this code import numpy as np
expected = np.array([[18.00000,9.00000,6.00000,9.00000,18.00000,33.00000],
[19.00000,6.00000,5.00000,9.00000,6.00000,5.00000]])
id_bests = np.vstack(
np.unravel_index(np.argsort(expected.ravel()), expected.shape)
).T
print(id_bests) produces different output under numpy 1.26 and numpy 2.0. I assume due to tie breaking 2.0 output |
Reminds me of the shapelet argsort issue under numba/no numba see #622 |
simplified further x= [18.00000,9.00000,6.00000,9.00000,18.00000,33.00000,19.00000,6.00000,5.00000,
9.00000,6.00000,5.00000]
args = np.argsort(x) gives different results in args under differnt numpy versions (and previously with and without numba #622). This is a very minor issue in one test, but we do use argsort quite a lot, might be time to implement our own version ... |
ah they have added a "stable" argument! Problem solved :) |
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.
Cant say I'm a fan of just removing all the expected outputs
if you dont you cannot be backward compatible as far as I can tell |
agree, I think we skip ones we care about and just dont print of the performance metric module. I dont know how docstring runs the comparison, not really motivated to find out |
|
Reference Issues/PRs
closes #2218
test numpy2 compliance over simple fixes
STRAY np.Inf -> np.inf
Catch22: change list to array prior to call to nan_to_num
performance_metrics.forecasting._functions
there is a difference in docstring tests: output of scalars appears as np.float64(x) not just x.
I have stripped out the expected output. Under numpy 2 it expects np.float64(0.0003), but that does not work with earlier numpy versions, where just 0.0003 is expected. the numbers are exactly the same