Conversation
- do not use underscores in functions args
…nce -> fix fix radius nn graph for spdist
try to install via before_install
# Conflicts: # pygsp/graphs/nngraphs/nngraph.py # pygsp/tests/test_graphs.py
…efactor # Conflicts: # README.rst
|
I have just added the function I coded to this branch to get the nearest neighbor search out of the Knn graph. The Knn graph function still needs to be modified. |
|
Thanks! Can you fix the tests? |
|
I tried, but failed. They work on my machine but the seed is different. I have to think about how to do it... Maybe you can help me. Let us discuss later... |
|
Tests are passing... The coverage is reduced (probably less raise Error check...) but I think it will increase again once the functions in _nearest_neighboors are cleaned. I wil do that before my vacation... Currently the code is not very clean... |
|
Ok Should be ready for the merge... |
|
@mdeff Everything is done. For me, it can be merged to master. |
|
Very nice to see more efficient knn search implementations for knn graph building! |
|
Thanks for the kind words @gcuendet. I mostly need to address review comments. I would also like to merge knn and radius graphs. I'll probably get to this in the not too far future as two other PRs (#55 and #57) depend on it. Then I'll make a new release. |
| if kind == 'knn': | ||
| params['k'] = k + 1 | ||
| elif kind == 'radius': | ||
| params['k'] = features.shape[0] # number of vertices |
There was a problem hiding this comment.
I think there is a problem here. This does not scale.
According to the doc of scipy.spatial.cKDTree.query
If x has shape tuple+(self.m,), then d has shape tuple+(k,).
Which means tree.query() is going to return a huge matrix of NxN.
This is actually different from scipy.spatial.KDTree.query which, according to the doc, returns :
If k is None, then d is an object array of shape tuple, containing lists of distances.
Which, if I understand correctly, means that tree.query() is going to return an array of size N containing lists with varying length, depending on the number of neighbours in the epsilon ball.
Anyway, I am testing this locally with the fountain dataset that you made available here and it seems that constructing a radius NN graph using this branch of pygsp crashes
G = graphs.NNGraph(points, kind='radius', radius=0.01,
standardize=False, kernel_width=0.1)
whereas using the pip version of pygsp does not.
G = graphs.NNGraph(points, NNtype='radius', epsilon=0.01,
rescale=False, sigma=0.1)
On my initial experiments, I also used scipy.spatial.cKDTree.query_ball_point() which only returns the indices, so distances need to be computed seperately. That might be an alternative maybe?
There was a problem hiding this comment.
See PR #60 about the use of scipy.spatial.cKDTree.query_ball_point()
|
|
I suggest the following:
|
|
|
Seeing all your proposition, I believe |
Contains PR #21 with some improvements.
Major fixes:
Major improvements:
Ohers: