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

Fixes for tests on nightly builds of numpy/scipy/pandas #6897

Merged
merged 6 commits into from
Oct 9, 2024

Conversation

janezd
Copy link
Contributor

@janezd janezd commented Sep 20, 2024

Issue

Scientific Python nightly wheels fails.

Description of changes
  • Cython code in Relief: Import NAN and INFTY from libc.math instead of from numpy.math. This caused an error in cythonizing.
  • Importin pytz: In test_pandas, do not import pytz. We do not (directly) depend on it, and pandas removes it in 3.0.
  • Indices in sparse matrices: Index-out-of-range error is a bug in scipy and was fixed in BUG: sparse: fix indexing after ellipsis and 2D array indexing scipy/scipy#21616.
  • Different result in nomograms: scipy changed the optimizer that is used for fitting logistic regression. @markotoplak fixed this by increasing the number of iterations
  • Time resolution in pandas: Pandas can now import time in 1 s resolution, where it previously used 1 ns, and the resulting type is <M8[s] instead of <M8[ns]. We convert this to floats containing seconds from epoch, so it doesn't affect us. A test failed just because it expected to see <M8[ns], so I changed the test.
  • Subclassing in pandas (OrangeDataFrame.sparse.todense will stop working in pandas 3.0 #6902): is caused by an old bug in pandas, now fixed in BUG: Fix SparseFrameAccessor.to_dense return type pandas-dev/pandas#59967. Our workaround stopped working in pandas 3. This PR correctly defines OrangeDataFrame, but for pandas < 3 it dynamically patches the bug in pandas. The patch can be removed when we raise pandas requirements to 3.0.
To be fixed elsewhere
  • Variable type guessing in Group By: The test that fails on Group by is a result of pandas being able to parse more date formats. This is a problem in Group By's design and is being fixed in GroupBy: Avoid guessing variable types #6906.

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.20%. Comparing base (eed39ef) to head (85638d9).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6897      +/-   ##
==========================================
- Coverage   88.21%   88.20%   -0.01%     
==========================================
  Files         326      326              
  Lines       71264    71266       +2     
==========================================
  Hits        62863    62863              
- Misses       8401     8403       +2     

@janezd janezd changed the title Relief: Fix import from numpy.math Fixes for latest versions of numpy/scipy/pandas Sep 23, 2024
@janezd janezd changed the title Fixes for latest versions of numpy/scipy/pandas Fixes for tests on nightly builds of numpy/scipy/pandas Sep 23, 2024
@janezd janezd force-pushed the fix-scientific-build branch 4 times, most recently from 973111f to f93e022 Compare October 3, 2024 07:39
@janezd janezd added the needs discussion Core developers need to discuss the issue label Oct 3, 2024
@markotoplak
Copy link
Member

In test_ownomogram.py, self._test_helper(self.lr_cls, [61, 39]) gives AssertionError: 'Probability: 61' not found in '<html><head> (...) <br/>Probability: 59%</body></html>\n. Did logistic regression changed and we can't do anything about it?

The optimizer in scipy changed. The correct final result is still the same. The problem is that Logistic Regression has a quite small default max_iter argument. Thus, the new and old optimizers stopped at different solutions. Increasing the number of iterations makes it OK for both.

@janezd janezd removed the needs discussion Core developers need to discuss the issue label Oct 4, 2024
janezd and others added 4 commits October 6, 2024 10:25
This is a proper solution that would work before and would continue
to work in pandas>=3 -- if it was not for a bug in pandas
(pandas-dev/pandas#59913).

Hence, this commit also (dynamically) patches the bug in pandas.
@markotoplak markotoplak merged commit b0acfd2 into biolab:master Oct 9, 2024
27 of 31 checks passed
@janezd janezd mentioned this pull request Oct 10, 2024
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

Successfully merging this pull request may close these issues.

2 participants