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

[FIX] PCA: ensure tests pass on sklearn 1.4 and 1.5, which can return different results #6821

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

pavlin-policar
Copy link
Collaborator

Issue

#6815 broke a few things that went under the radar, primarily due to scikit-learn 1.5.0 changes.

Includes
  • Code changes
  • Tests
  • Documentation

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.26%. Comparing base (8831a57) to head (b9625da).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6821      +/-   ##
==========================================
- Coverage   88.26%   88.26%   -0.01%     
==========================================
  Files         326      326              
  Lines       71156    71158       +2     
==========================================
+ Hits        62805    62806       +1     
- Misses       8351     8352       +1     

@pavlin-policar
Copy link
Collaborator Author

@markotoplak As far as I can tell, none of the remaining failures have anything to do with #6815. This should be good to merge.

@pavlin-policar
Copy link
Collaborator Author

For posterity's sake: PCA can produce different results between scikit-learn versions 1.4.0 and 1.5.0 in that the directions of the vectors may be flipped. While they do ensure a consistent output within each version of scikit-learn using their svd_flip function here, the u_based_decision was changed to False in 1.5.0, while it was True (the default) in prior versions of scikit-learn. Here is the commit that makes this change.

This change, which causes inconsitencies between scikit-learn 1.4.0 and 1.5.0 was not discussed in their PR, but it was apparently necessary to make the outputs of PCA consistent between the different solvers in 1.5.0 (original PR and comment here).

@markotoplak markotoplak changed the title pca: fix failing tests due to svd_flip mismatch between sklearn 1.4/1.5 [FIX] PCA: ensure tests pass on sklearn 1.4 and 1.5, which can return different results Jun 7, 2024
@markotoplak markotoplak merged commit 55905a4 into biolab:master Jun 7, 2024
21 of 30 checks passed
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