cdlib.evaluation.ecs

cdlib.evaluation.ecs(first_partition: object, second_partition: object, alpha: float = 0.9, r: float = 1.0, r2: float | None = None, rescale_path_type: str = 'max', ppr_implementation: str = 'prpack') MatchingResult

以元素为中心的聚类相似性。

Parameters:
  • first_partition – NodeClustering 对象

  • second_partition – NodeClustering 对象

  • alpha – 个性化页面排名返回概率,作为[0,1]范围内的浮点数。浮点数,默认值为0.9

  • r – 用于聚类1的层次缩放参数。浮点数,默认值为1.0

  • r2 – 用于clustering2的分层缩放参数。float,默认为None

  • rescale_path_type – 通过以下方式重新调整层次高度:'max' 从根节点到叶节点的最大路径;'min' 从根节点到叶节点的最小路径;'linkage' 使用聚类中的链接距离。

  • ppr_implementation – 选择用于个性化页面排名计算的实现方式:'prpack' 使用 igraph 中的 PPR 算法;'power_iteration':使用 power_iteration 方法。

Returns:

匹配结果对象

Example:

>>> from cdlib import evaluation, algorithms
>>> import networkx as nx
>>> g = nx.karate_club_graph()
>>> louvain_communities = algorithms.louvain(g)
>>> leiden_communities = algorithms.leiden(g)
>>> evaluation.ecs(louvain_communities,leiden_communities)
Reference:

A.J. Gates, I.B. Wood, W.P. Hetrick, 和 YY Ahn [2019]. “以元素为中心的聚类比较统一了重叠和层次结构”. 科学报告 9, 8574

注意

该函数需要安装clusim库。您可以通过pip安装:pip install clusim