SOLVED

Louvain clustering with R wpa network_p2p

Copper Contributor

Hi all,

I was running a network analysis on p2p data using R and creating clusters using the louvain option yesterday. Today, I was continuing some analysis and running additional tables using the same data set and option within network_p2p() when I noticed that the clusters changed. Not just the cluster numbers but the people within the clusters are different, i.e., cluster 2 did not just become cluster 5, etc. 

In theory, the Louvain clustering should remain the same composition as far as I understand. However, this doesn't seem to be the case.

Anyone have any suggestions in order to make sure that the analysis is reproduceable? There is no option to set a seed (nor do I think that is applicable) for Louvain.

Thanks!

2 Replies

Hi @ant_molisani - thank you for your question! I was able to reproduce your error, so I have created a GitHub issue (https://github.com/microsoft/wpa/issues/221) and we will look into resolving this. 

My initial suspicion is that (1) Louvain is a stochastic algorithm, so seeding must happen in order to make the results deterministic, and (2) the seeding needs to happen in the function environment rather than outside of it for this to work. Will be looking into this, and will update this when we can find a solution! 

best response confirmed by ant_molisani (Copper Contributor)
Solution

@ant_molisani - initial suspicion was right - this was resolved by adding `set.seed(seed = seed)` within the function, prior to the line where the louvain algorithm was run. 

This is now being addressed in the following pull request: https://github.com/microsoft/wpa/pull/222

Once it is merged, you should be able to use the new function by installing the development version of the package on GitHub. The production version will be released in the next CRAN release cycle.

1 best response

Accepted Solutions
best response confirmed by ant_molisani (Copper Contributor)
Solution

@ant_molisani - initial suspicion was right - this was resolved by adding `set.seed(seed = seed)` within the function, prior to the line where the louvain algorithm was run. 

This is now being addressed in the following pull request: https://github.com/microsoft/wpa/pull/222

Once it is merged, you should be able to use the new function by installing the development version of the package on GitHub. The production version will be released in the next CRAN release cycle.

View solution in original post