-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
FIX validate input array-like in KDTree and BallTree #18691
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b7df9fc
Raise error, add a test.
cmarmo 5117316
Temporary what's new.
cmarmo cec423f
Fix lint error. Final what's new.
cmarmo b2a0b3b
Merge branch 'master' into tree-segfault
cmarmo 8fbc490
Add dtype in tests, following NEP 34.
cmarmo 9d772cd
Merge branch 'master' into tree-segfault
cmarmo bce45b5
Move validation before shape call.
cmarmo dfbdeda
Address comments. Add tests.
cmarmo 65470b6
Merge branch 'master' into tree-segfault
cmarmo f2868e5
Address comments.
cmarmo 23a7c22
Revert some comments.
cmarmo a02ff0a
Merge branch 'master' into tree-segfault
cmarmo c66f8bd
Reduce variables in test.
cmarmo 2291746
Merge branch 'master' into tree-segfault
cmarmo 796ae8b
Add a case test for KDTree.
cmarmo 5a99ed9
Fix lint error.
cmarmo 53ed703
Merge branch 'master' into tree-segfault
cmarmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from sklearn.neighbors._kd_tree import KDTree | ||
|
||
DIMENSION = 3 | ||
|
||
METRICS = {'euclidean': {}, | ||
'manhattan': {}, | ||
'chebyshev': {}, | ||
'minkowski': dict(p=3)} | ||
|
||
|
||
def test_array_object_type(): | ||
"""Check that we do not accept object dtype array.""" | ||
X = np.array([(1, 2, 3), (2, 5), (5, 5, 1, 2)], dtype=object) | ||
with pytest.raises( | ||
ValueError, | ||
match="setting an array element with a sequence" | ||
): | ||
KDTree(X) |
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.
Uh oh!
There was an error while loading. Please reload this page.