netneurolab / netneurotools

Useful tools from the Network Neuroscience Lab
https://netneurolab.github.io/netneurotools
BSD 3-Clause "New" or "Revised" License
60 stars 32 forks source link

Gamma value for consensus partition #110

Closed balandongiv closed 2 years ago

balandongiv commented 3 years ago

In the example plot_consensus_clustering.py, 100 solutions was obtained using a gamma equal to 1.5.

https://github.com/netneurolab/netneurotools/blob/503d9ade5af5531207b4b623816dd9bf4ac3e235/examples/plot_consensus_clustering.py#L74

Then, the example followed by the creation of consensus partition.

However, gamma equal to 1 is used throughout the operation of creating the consensus partition.

Shouldn't this value set to equal to 1.5?

Trace of the code will bring to the modularity_louvain_und_sign under 'bct': L1197, which have a default gamma value of 1

https://github.com/netneurolab/netneurotools/blob/503d9ade5af5531207b4b623816dd9bf4ac3e235/netneurotools/cluster.py#L365

https://github.com/aestrivex/bctpy/blob/32c7fe7345b281c2d4e184f5379c425c36f3bbc7/bct/algorithms/clustering.py#L353

https://github.com/aestrivex/bctpy/blob/32c7fe7345b281c2d4e184f5379c425c36f3bbc7/bct/algorithms/modularity.py#L1197

Under L1197, the default gamma value is 1.

VinceBaz commented 2 years ago

Hey @balandongiv! I am sorry for the delay.

I do not think that the gamma value used when creating the consensus partition should necessarily be set to 1.5.

My reasoning here is that the type of matrix that the Louvain algorithm is used on when creating the consensus partition is the agreement matrix, and not the original connectome. The entries of this agreement matrix are values between 0 and 1 that denote the probability of finding node i in the same community as node j across all the solutions.

From my understanding, the gamma parameter is especially useful when we think that there might be communities across multiple scales. For our agreement matrix, we however know that it is not the case since we relied on a specific gamma value when computing each individual solution. It therefore makes sense to use a "conventional" gamma value of 1.0 when creating the consensus partition.

I hope it makes sense! :)

balandongiv commented 2 years ago

Thanks for the detail explanation @VinceBaz .

IIUC, gamma determine the detected modules size, where gamma > 1 detects smaller modules.and vice versa. Restricting gamma equal to 1 might not reveal the true community size within the consensus partition. Please correct me if my understanding is wrong as I am still new in this domain.

From my email exchange with @Brastislav, atleast in their paper "“Dopamine Signaling Modulates the Stability and Integration of Intrinsic Brain Networks” ", they used the same gamma value for both steps. Specifically, the gamma 1.5 is used for extracting 250 partitions, and for creating consensus partition from the 250 partition.

Because of these, I am confuse about the best practice in setting gamma especially when creating consensus partition. But, I assume, atleast for your (@VinceBaz ) paper, the gamma for consensus partition will be fixed to 1, right?

Thanks for entertaining this OP

VinceBaz commented 2 years ago

You are correct. When you use a gamma value larger than one, the modules that you detect should be smaller. When we run a community detection algorithm on the FC connectome, we do not know the true community size, so it is indeed important to look across multiple values of gamma to identify the one that gives the best partition (as they did in the 2019 Cerebral Cortex paper that you talked about).

When we know the actual scale of the communities, however, you should obtain the same modules regardless of the value of the gamma parameters that you use. This is the case for the agreement matrix, which should not have a multiscale modular architecture.

I actually did try it, to show as an example. If you take a look at the figure below, in (a) you have the FC matrix and in (b), you have the mean number of communities in the FC matrix as a function of the gamma value. As you described, the larger the gamma is, the larger the number of communities. If try to do something similar in an agreement matrix like the one shown in (c), you see that the number of communities you obtain does not change, regardless of the value of gamma used.

role_of_gamma_2

So basically, it should not matter which gamma you use when creating the consensus partition. I do however prefer using gamma=1, which is indeed the gamma value that I used in my 2021 Neuroimage paper.

balandongiv commented 2 years ago

Thanks for the comprehensive explanation and illustration @VinceBaz . This really help me understand the subject better.

If I can suggest, maybe you can link this thread in the tutorial.