barahona-research-group / PyGenStability

PyGenStability: Multiscale community detection with generalized Markov Stability
https://barahona-research-group.github.io/PyGenStability/
GNU General Public License v3.0
32 stars 11 forks source link

new scale selection algorithm #63

Closed d-schindler closed 1 year ago

d-schindler commented 1 year ago

This PR is to implement a new scale selection algorithm, see issue #62

arnaudon commented 1 year ago

@d-schindler is this a final implementation? Just to know if I can fix tests now and merge or wait a little longer

d-schindler commented 1 year ago

no, it's not final, I'm just about to commit some changes

d-schindler commented 1 year ago

The implementation of the scale selection algorithm is now final. I checked for all our examples and it seems to work well. The algorithm works as follows:

  1. We apply average-pooling to NVI(t,t') and determine the local minima of the smoothed diagonal and obtain basins of fixed radius around each local minima. These basins correspond to the blocks.
  2. Within each basin we determine the minium of NVI(t) and these minima are the robust scales.

So we don't have a single criterion as before that we could plot but it is a sequential procedure. Hence, I adapted the plotting and propose to plot the pooled diagonal over the heatmap and have NVI(t) separately. Let me know if you would like to organise it differently.

The plotting is still a bit troublesome, e.g. the "log(t)" ylabel for the heatmap is not displayed in the example notebooks and NVI(t) is not scaled correctly in multiscale_example.py. I tried to fix this but the plotting is a bit tricky.

arnaudon commented 1 year ago

@d-schindler I don't get the sequential procedure, I still see a single black line in your plot, right? Why swapping NVI and scale criterion?

arnaudon commented 1 year ago

@d-schindler , if it's ok with you like that, I'll merge tomorrow!

d-schindler commented 1 year ago

I slightly preferred my organisation of the summary plot but we can discuss on Teams.

d-schindler commented 1 year ago

But it might be fine as is for the moment and I can create a new PR at a later point?