Fix compatibility with modern scikit-learn and Python versions#15
Open
kopeckylukas wants to merge 16 commits intoDTUComputeStatisticsAndDataAnalysis:masterfrom
Open
Fix compatibility with modern scikit-learn and Python versions#15kopeckylukas wants to merge 16 commits intoDTUComputeStatisticsAndDataAnalysis:masterfrom
kopeckylukas wants to merge 16 commits intoDTUComputeStatisticsAndDataAnalysis:masterfrom
Conversation
… function to ensure compatibility with scikit-learn version 1.6 and later
…rings using `is not` instead of `!=`. `is not` compares object identity, not value.
StandardScaler.inverse_transform now requires 2D input in newer versions of scikit-learn. Reshape the loadings slice to 2D before inverse transforming and flatten the result.
uptil this point, matplotlib was an extra, but the example code requires it, therefore, it was changed to requirements
*This is a newly maintained version of the MBPLS software originally developed by Andreas Baum and Laurent Vermue (homepage: https://github.com/DTUComputeStatisticsAndDataAnalysis/MBPLS/). This maintained version has been updated to be compatible with Python 3.8 and later. Lukas Kopecky, April 2026.*
…pyproject.toml configuration file
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributing to bug fixes
Link to the relevant Bug(s)
Fixes Issues:
Description of the Change
For #12
For #13
For #14
is notinstead of!=. (SyntaxWarning: "is not" with 'str' literal. Did you mean "!="? if self.method is not 'SIMPLS').is notcompares object identity, not value.Possible Drawbacks
The behaviour was only tested for the latest versions of Python (3.11 and later) and dependencies (scikit-learn v1.6 and later). This bridges the gap of over 6 years since the last release. It is possible that these changes will not work for intermediate versions of packages.
Further, the updated version does not pass pytests. However, this code did not introduce any changes to the code itself and only addressed Syntax and Type errors caused by dependencies API changes. The failed pytest are likely due to changes in the way random seeds are handled when data are generated.
Verification Process
Run example code to ensure the code can now be run without errors and future warnings, and attempted to run existing unit tests. The result of those tests described in Possible Drawbacks section.
Release Notes
Fixed scikit-learn compatibility issue where StandardScaler.inverse_transform requires 2D input (scikit-learn ≥1.0) by reshaping the loadings slice in the plot method (Plot error #12).
Replaced deprecated force_all_finite parameter with ensure_all_finite in check_array calls for compatibility with scikit-learn ≥1.6 (TypeError when fitting the model #13).
Fixed SyntaxWarning by replacing identity comparison (is not) with value comparison (!=) for string literals (SyntaxWarning when fitting the model #14).