-
Notifications
You must be signed in to change notification settings - Fork 79
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
graph.Graph build_* constructors #542
Conversation
Codecov Report
@@ Coverage Diff @@
## geographs #542 +/- ##
===========================================
+ Coverage 79.5% 80.9% +1.4%
===========================================
Files 124 125 +1
Lines 14235 14353 +118
===========================================
+ Hits 11315 11606 +291
+ Misses 2920 2747 -173
|
FYI, the result of |
Should we open a fresh issue for this? |
I fixed that in the meantime. Need to write a test and push. |
From further testing, it is clear that I'll add missing docstrings and this should be ready to go. |
Still cooking, but this would only affect the KNN "branch" (
It would help to understand what this means? This implementation was adopted because it was quite a bit faster than our existing On isolates, I notice the |
Nothing in the end. I thought we'd expose distance band as a specific case of kernel as discussed, in which case we would need a different query but I have it now implemented on a local branch separately.
yup, it is likely that isolates are not yet properly handled in all cases.
What do you mean "the last m row/columns"? Isolates are not necessarily last in any representation as far as I understand. |
this is exacty what i was struggling with in the shoehorn-implementation i originally drafted. There, the isolates always get appended to the end of the adjlist, so thats why i ended up needing the sort method |
We could potentially use something like I've implemented here instead of |
(we talked about why we dont want to expose sorting, but if we could, it would make this dead simple, because we could always re-align the graph with the df after subsetting the graph) |
So, distance band should still allow for kernels underneath the banding, right? Basically, we have three possible implementations:
It'd be good to figure out a way to keep this API consistent... I had thought that distance banding could be achieved using a kernel weight with a boxcar kernel?
For the graph import numpy
A = numpy.array([
[0,1,0,0]
[1,0,1,0]
[0,1,0,0]
[0,0,0,0]
]) If we pass arrays: i,j = A.nonzero() Then we only know about A,B,C, not D. We would need to provide either |
and this is how i ended up doing it. Instantiate a matrix that includes rows of zeros, then tell the W what those mean. so it feels like if we're going to expose id2i, we might as well include sort... because any time we need sparse, the ordering matters and sometimes its useful to control that? |
it could but you don't know K to pass to
Yeah, that is not a solved case at the moment. All these edge cases will need special attention but I guess it is easier to figure out the solution on top of basic implementation.
|
What about treating knn and distance band as ways to build a "precomputed" distance matrix for kernel to apply a kernel function to? This would let knn code to live in the knn function, and likewise for radius/distanceband, leaving kernel simpler for all the rest of the methods that pass into it? |
That sounds nice. Let me give it a go since I am touching this as we speak. Will open a PR to discuss on top of code. |
A draft of treating knn and distance band as precomputed matrices is in #544. |
No description provided.