Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kdtree
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cython-plus
kdtree
Commits
cb190664
Commit
cb190664
authored
3 years ago
by
Julien Jerphanion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TST Add test for creation and deletion of KDTree
parent
27283fbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
Makefile
Makefile
+1
-1
tests/test_conf.py
tests/test_conf.py
+15
-4
No files found.
Makefile
View file @
cb190664
...
...
@@ -33,7 +33,7 @@ setup: clean
conda
env
create
--force
-f
environment.yml
${PIP_EXECUTABLE}
install
-e
.
-v
## install:
install the project in the env
## install:
Install the project in the environment
.PHONY
:
install
install
:
${PIP_EXECUTABLE}
install
-e
.
-v
...
...
This diff is collapsed.
Click to expand it.
tests/test_conf.py
View file @
cb190664
...
...
@@ -3,6 +3,18 @@ import pytest
import
kdtree
from
sklearn.neighbors
import
KDTree
@
pytest
.
mark
.
parametrize
(
"n"
,
[
10
,
100
,
1000
,
10000
])
@
pytest
.
mark
.
parametrize
(
"d"
,
[
10
,
100
])
@
pytest
.
mark
.
parametrize
(
"leaf_size"
,
[
256
,
1024
])
def
test_creation_deletion
(
n
,
d
,
leaf_size
):
np
.
random
.
seed
(
1
)
X
=
np
.
random
.
rand
(
n
,
d
)
tree
=
kdtree
.
KDTree
(
X
,
leaf_size
=
256
)
del
tree
@
pytest
.
mark
.
skip
(
reason
=
"The query is being refactored."
)
@
pytest
.
mark
.
parametrize
(
"n"
,
[
10
,
100
,
1000
,
10000
])
@
pytest
.
mark
.
parametrize
(
"d"
,
[
10
,
100
])
@
pytest
.
mark
.
parametrize
(
"k"
,
[
1
,
2
,
5
,
10
])
...
...
@@ -11,12 +23,11 @@ def test_against_sklearn(n, d, k, leaf_size):
np
.
random
.
seed
(
1
)
X
=
np
.
random
.
rand
(
n
,
d
)
query_points
=
np
.
random
.
rand
(
n
,
d
)
tree
=
kdtree
.
KDTree
(
X
,
leaf_size
=
256
)
skl_tree
=
KDTree
(
X
,
leaf_size
=
256
)
closests
=
np
.
zeros
((
n
,
k
),
dtype
=
np
.
int32
)
tree
.
query
(
query_points
,
closests
)
skl_closests
=
skl_tree
.
query
(
query_points
,
k
=
k
,
return_distance
=
False
).
astype
(
np
.
int32
)
np
.
testing
.
assert_equal
(
closests
,
skl_closests
)
\ No newline at end of file
np
.
testing
.
assert_equal
(
closests
,
skl_closests
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment