社区发现算法 | Louvain 算法 中的分辨率参数
Louvain 算法
1. 算法作者的网站
http://www.ludowaltman.nl/slm/
黑色字体的第二段末尾说,三种 Louvain 实现都支持 分辨率 参数,用来决定检测到社区的粒度:
All algorithms implemented in the Modularity Optimizer support the use of a resolution parameter to determine the granularity level at which communities are detected.
手写 Louvain 算法时,这个 分辨率 参数怎么体现呢?
是 deltaQ 小于某个值时迭代终止?
该网页提供的代码是java版本的:
http://www.ludowaltman.nl/slm/modularity_optimizer_source.zip
有用硬着头皮看看吧。。。
(2) 分辨率参数的论文
通过其他地方的引用和介绍,多方证据印证,就是这篇论文引入的time 参数,后来被称为 resolution 参数了。
-
How to use “resolution” when applying louvaon algorithm for community detection?
-
分辨率 paper: Laplacian Dynamics and Multiscale Modular Structure in Networks : https://arxiv.org/abs/0812.1770
Another paper Laplacian Dynamics and Multiscale Modular Structure in Networks that is referenced by the implementation of the python-louvain library refers to this as time. -
NextworkX has a resolution parameter:
>>> community.best_partition(graph, partition=None, weight=’weight’, resolution=1.0, randomize=None, random_state=None)
resolution [double, optional] Will change the size of the communities, default to 1.
represents the time described in “Laplacian Dynamics and Multiscale Modular Structure in Networks”,
R. Lambiotte, J.-C. Delvenne, M. Barahona
- 也有文章讨论 resolution 的局限性: Narrow scope for resolution-limit-free community detection | 2011 pdf | pdf2 | pubmed
(3) Rigraph 上的争论
https://github.com/igraph/rigraph/issues/239
观众: 原算法作者的java代码支持 分辨率,希望R版本的 igraph 也支持: http://www.ludowaltman.nl/slm/
igraph 作者: R包Seurat已经通过Rcpp支持了。
观众: 不行,我就要,防止代码扩散嘛
作者: Rigraph 打算在支持 Leiden 算法时添加分辨率参数。
最后,有人提交了一个C版本的PR: (commented on 2 Jun 2020)
https://github.com/jmonlong/Hippocamplus/blob/config/R/rigraph_gammalouvain/community.c
2. 其他短小的python 实现
(1) 实现1: 没有 resolution 参数
https://blog.csdn.net/qq_16543881/article/details/122825957
这个有问题,小数据集看着还行;
但是对于 3000 个顶点的 pbmc 3k 真实数据集,直接输出了和点数一样的社区数,肯定哪里不对。
修正版: Louvain_5.py
ref:
- 介绍 Louvain 算法及其实现 https://zhuanlan.zhihu.com/p/522751212
- 几篇 Louvain 的论文的区别: https://blog.csdn.net/qq_16543881/article/details/123575014
- Louvain 2018: https://eecs.wsu.edu/~ananth/papers/Ghosh_IPDPS18.pdf
- java 版的调试: https://blog.51cto.com/u_15693947/5409361
更多推荐
所有评论(0)