Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython_plus_experiments
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
0
Merge Requests
0
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
Julien Jerphanion
cython_plus_experiments
Commits
4689a19c
Commit
4689a19c
authored
Jun 11, 2021
by
Julien Jerphanion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Heap to query multiples neighbours
parent
1dfa85af
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
98 deletions
+150
-98
kdtree/kdtree.pyx
kdtree/kdtree.pyx
+127
-96
kdtree/query_poc.py
kdtree/query_poc.py
+21
-0
kdtree/tests/test_conf.py
kdtree/tests/test_conf.py
+2
-2
No files found.
kdtree/kdtree.pyx
View file @
4689a19c
This diff is collapsed.
Click to expand it.
kdtree/query_poc.py
0 → 100644
View file @
4689a19c
import
numpy
as
np
import
pytest
import
kdtree
from
sklearn.neighbors
import
KDTree
if
__name__
==
'__main__'
:
n
=
1000
n_query
=
100
d
=
10
k
=
10
np
.
random
.
seed
(
1
)
X
=
np
.
random
.
rand
(
n
,
d
)
query_points
=
np
.
random
.
rand
(
n_query
,
d
)
tree
=
kdtree
.
KDTree
(
X
,
leaf_size
=
256
)
closests
=
np
.
zeros
((
n_query
,
k
),
dtype
=
np
.
int32
)
# There's currently a deadlock here
tree
.
query
(
query_points
,
closests
)
\ No newline at end of file
kdtree/tests/test_conf.py
View file @
4689a19c
...
@@ -14,8 +14,8 @@ def test_against_sklearn(n, d, leaf_size):
...
@@ -14,8 +14,8 @@ def test_against_sklearn(n, d, leaf_size):
tree
=
kdtree
.
KDTree
(
X
,
leaf_size
=
256
)
tree
=
kdtree
.
KDTree
(
X
,
leaf_size
=
256
)
skl_tree
=
KDTree
(
X
,
leaf_size
=
256
)
skl_tree
=
KDTree
(
X
,
leaf_size
=
256
)
closests
=
np
.
zeros
((
n
),
dtype
=
np
.
int32
)
closests
=
np
.
zeros
((
n
,
2
),
dtype
=
np
.
int32
)
tree
.
get_closest
(
query_points
,
closests
)
tree
.
query
(
query_points
,
closests
)
skl_closests
=
skl_tree
.
query
(
query_points
,
return_distance
=
False
)
skl_closests
=
skl_tree
.
query
(
query_points
,
return_distance
=
False
)
# The back tracking part of the algorithm is not yet implemented
# The back tracking part of the algorithm is not yet implemented
...
...
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