Fix tests that fail due to changes in sklearn 0.24.0 #1215
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.
What does this PR do?
Fixes the test (
test_score_2
intpot_tests.py
) that was erroring on versions of sklearn >= 0.24.0 by adding a dictionary of scores for different sklearn versions. This was also done for test_score_3 - though that test didn't fail, the same method was implemented to make it easier to address the possibility of sklearn updates causing it to fail in the future. Versions from 0.22.0 onwards were included in the dict as this is the minimum version TPOT currently requires.Where should the reviewer start?
Review
tests/tpot_tests.py
to see the changes made. No other changes were made in this PR.How should this PR be tested?
Run the nosetests using TPOT on multiple versions of sklearn (all major releases between 0.22 and 0.24.2 were tested and included) and confirm that they all pass as expected.
Any background context you want to provide?
sklearn 0.24.0 introduced a change to KNeighborsClassifier (scikit-learn/scikit-learn#17038) that started causing the TPOT test for the known score of a pipeline including this classifier to fail. To make it easier to address this in the future while also supporting multiple versions of sklearn (rather than just the most recent), it would be useful if TPOT would check which sklearn version to use a known score from.
#1161 fixes a different test that was failing for similar reasons (changes in sklearn 0.24.0 moving an import).
What are the relevant issues?
This is one of the tests that #1175 (and many other PRs since) have failed despite making no changes to the functionality implemented by these functions.
The other failing test (due to an import in
one_hot_encoder.py
was previously addressed with #1161).Screenshots (if appropriate)
N/A
Questions: