Repository navigation
Add panther++ - #4400
Add panther++#4400
Conversation
|
@mrecachinas thanks for this PR and #3886! There will be a NetworkX release in the near future (O[weeks]) which will have |
|
@rossbar I'm good with either -- definitely up to you all. The paper refers to the actual Panther path similarity algorithm simply as "Panther" and the vector similarity algorithm as "Panther++" -- I wasn't sure about naming it |
|
Guys, since I was the one who brought the panther paper as a feature request, I will chip in and give my two cents. Since the algorithm and code returns a dictionary of nodes, I prefer Also |
|
+1 for the |
|
Sounds good! |
|
Also, wanted to revisit if @dschult @rossbar @jarrodmillman had anymore thoughts on a more permanent home for |
|
I think we should leave |
|
Re: naming, I agree with @dschult and @storopoli : Panther ->
I agree. If it is likely that |
|
I would go with |
|
The problem with making it a private function is that people won't see it or know they can use it. This is potentially a useful function for sampling paths. We shouldn't hide it. If we use an underscore and still put it in the If it was up to me, I would leave it where it is without an underscore. If we get NXEP3 in place for v3.0 then I feel like we can still move the function to a new location within the package for v3.0. The API for the function will be the same. The function will still be the same -- we're only deprecating the location within the package. I'm open to adding the |
|
I think we all understand the arguments for making it public or private. So I will leave it to @dschult to decide. It if is made public in 2.6 and deprecated in 2.7, we can still remove it in 3.0. If it is deprecated after the 3.0 release, it can be removed in 3.2. |
|
@dschult Here is another suggestion (but you and Ross should make the call on this): We could mark the function private in |
|
Interesting... Lots of Options... |
|
TL;DR - I agree with @dschult , I'm +1 on having I think the points in @dschult 's points are the most compelling. One thing that I hadn't considered was that |
There was a problem hiding this comment.
Thanks for the updates @mrecachinas - as I see it there are still 3 things that need to be addressed:
- Let's remove the addition of the exception for isolated nodes inside
generate_random_path. Off the top of my head there are two relatively simple alternatives that don't affect backward compatibility:- Explicitly check for degree-0 nodes before calling
generate_random_pathswithin the panther function(s) - When an isolated node is selected, an exception is already raised so you could wrap the
generate_random_pathscall inside a try/except catching ValueError's that result from bad transition probabilities.
- Explicitly check for degree-0 nodes before calling
- The doctest failure shows that the result is not deterministic. That may be okay, but let's double-check the source of the non-determinism and ensure it's not a result of failing to seed something.
- The other test failure also seems real - I'd guess whatever fix was put in place for the k-off-by-one issue isn't working properly for k=1.
|
@rossbar Thanks for the feedback:
Yeah good call here. Should be addressed in cb5cf49.
Struggling with this one -- I can't reproduce the error we're seeing in CI. 🤔
The issue was in querying the KD-tree. There was an implicit assumption that the source node would always be returned in the |
I see - in that case it's probably worth a note in the docstring. On a related note - while reading through the kdtree docstring I noticed this:
This seems directly relevant to our default choice of |
|
@rossbar Think I covered your last two points. Lmk. |
|
I think the remaining item for this is the default value of |
|
@dschult I've changed it to 10. Thinking about this a bit more, the In any case, I did change it from 15 -> 10. |
|
The sklearn version of KDtree has a default dimension of 40. I'm thinking we should probably merge this and figure out how to handle the KDtree issues in follow-up PRs. Thoughts? |
|
SGTM |
Works for me, thanks for taking a look @dschult ! |
rossbar
left a comment
There was a problem hiding this comment.
This LGTM, thanks @mrecachinas for sticking with it and your helpful responses to all the questions/back-and-forth!

As discussed, follow on to #3886.
This PR implements the Panther++ algorithm from https://doi.org/10.1145/2783258.2783267. In particular, a couple decisions were made to improve the algorithm's performance:
similarities(i.e.,1 / || theta(v_i) - theta(v_j) ||) into a true similarity metric. Perhaps just normalized to between 0 and 1?panther_similarityandpanther_similarity_ppRenameChanging topanther_similaritytopanther_path_similarity?panther_similarity_pp.Find a better place forLeaving for now.generate_random_paths?