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

added directed constructor + MI -> VI #21

Closed peach-lucien closed 3 years ago

peach-lucien commented 4 years ago

created constructor for directed markov stability- potentially broken.

arnaudon commented 4 years ago

@peach-lucien is this all what you wanted to add? So we won't use MI anymore, but only VI? Don't merge that yet, I'll clean it up a bit before we do! Could you just give me the place where you took the entropy function? Thanks!

peach-lucien commented 4 years ago

@peach-lucien is this all what you wanted to add? So we won't use MI anymore, but only VI? Don't merge that yet, I'll clean it up a bit before we do! Could you just give me the place where you took the entropy function? Thanks!

I took the entropy function from the MI measure. https://github.com/scikit-learn/scikit-learn/blob/0fb307bf3/sklearn/metrics/cluster/_supervised.py#L570

The issue here is that I've implemented the normalised VI, but normalised using the joint entropy. In previous versions, the VI was normalised using n*log(n) instead. It seems that there are different methods in literature.

I need to implement the other directed constructor methods - currently there is one implemented. But the matlab version of stability shows other implementations. I will get onto this soon

arnaudon commented 4 years ago

Ah cool, then do

from sklearn.metric.clusters import entropy

instead of copy pasting the function ;)

@michaelschaub do you remember what is the convention in markov stability for normlisation of VI? tbh, I have never looked at that in details

michaelschaub commented 4 years ago

In the Matlab version the normalization is the simplest, i.e., VI_norm = VI / log(N).

For a large number of other variants (and a paper discussing them) see here: https://github.com/Hoosier-Clusters/clusim

arnaudon commented 3 years ago

@peach-lucien , I have cleanup up the directed constructor, could you add a simple example in the example folder, to see if it works? Thanks!

arnaudon commented 3 years ago

In fact, let me merge this, and we do another one with more examples.