fix: sklearn compat for validate_data import (issue #365)#371
Open
mani-baktha wants to merge 1 commit intogc-os-ai:mainfrom
Open
fix: sklearn compat for validate_data import (issue #365)#371mani-baktha wants to merge 1 commit intogc-os-ai:mainfrom
mani-baktha wants to merge 1 commit intogc-os-ai:mainfrom
Conversation
validate_data was introduced as a module-level function in scikit-learn 1.6. On sklearn 1.3–1.5 the import raised ImportError, breaking pyaptamer.aptanet. Added a try/except fallback to sklearn_compat for older versions. Added regression test to guard against future regressions. Fixes gc-os-ai#365
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.
validate_datawas introduced as a module-level function in scikit-learn 1.6,but
pyproject.tomldeclares support forscikit-learn>=1.3.0,<1.8.0, meaningusers on 1.3–1.5 cannot use the library at all.
Fix
Added a
try/exceptfallback in_feature_classifier.pythat importsvalidate_datafromsklearn_compatwhen the sklearn version does not exposeit as a standalone function.
sklearn_compatis already an indirect dependencyof the project (via
imbalanced-learn).Changes
pyaptamer/aptanet/_feature_classifier.py— replaced bare import withversion-safe try/except shim
pyaptamer/aptanet/tests/test_aptanet.py— added regression testtest_validate_data_importableto guard against future regressionsTesting
All 106 tests pass.