TST Common tests between KDTree and BallTree#15148
Merged
thomasjpfan merged 7 commits intoscikit-learn:masterfrom Oct 9, 2019
Merged
TST Common tests between KDTree and BallTree#15148thomasjpfan merged 7 commits intoscikit-learn:masterfrom
thomasjpfan merged 7 commits intoscikit-learn:masterfrom
Conversation
rth
commented
Oct 7, 2019
|
|
||
|
|
||
| def test_node_heap(n_nodes=50): | ||
| rng = np.random.RandomState(42) |
Member
Author
There was a problem hiding this comment.
A global mutable RNG was previously reused which is not great with respect to test determinism (given that order of tests can change).
ogrisel
approved these changes
Oct 8, 2019
Member
ogrisel
left a comment
There was a problem hiding this comment.
Small nitpicks but otherwise LGTM.
| 'Cls, metric', | ||
| itertools.chain( | ||
| [(KDTree, metric) for metric in KD_TREE_METRICS], | ||
| [(BallTree, metric) for metric in BALL_TREE_METRICS])) |
thomasjpfan
approved these changes
Oct 9, 2019
Member
There was a problem hiding this comment.
LGTM, please rename sklearn/neighbors/tests/test_tree.py to sklearn/neighbors/tests/test_nearest_neighbors_tree.py as suggested #15148 (comment)
Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>
Member
Author
|
Thanks @thomasjpfan, should be good now. (Renamed to |
Member
|
Thank you @rth! |
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.
The API of KDTree and BallTree is almost identical, and yet they have separate test files probably because they were written when pytest parametization were not used.
This puts some of redundant tests from
test_kd_tree.pyandtest_ball_tree.pyinto a common filetest_tree.py.Started with two tests, but more tests could be factorized in the future. This helps ensure that the API is consistent, and reduce the amount of redundant edits that are needed when we change something.