cdlib.viz.plot_scoring¶
- cdlib.viz.plot_scoring(graphs: list, ref_partitions: object, graph_names: list, methods: list, scoring: ~typing.Callable[[object, object], object] = <function adjusted_mutual_information>, nbRuns: int = 5) object¶
绘制一系列方法在一系列图表上获得的分数。
- Parameters:
graphs – 用于计算的图列表
ref_partitions – 与图对应的参考聚类列表
graph_names – 要显示的图表名称列表
methods – 以图作为输入并返回聚类作为输出的函数列表
scoring – 使用的评分函数,默认为anmi
nbRuns – 每个方法在每个图上运行的次数
- Returns:
一个 seaborn 线图
示例:
>>> from cdlib import algorithms, viz, evaluation >>> import networkx as nx >>> g1 = nx.algorithms.community.LFR_benchmark_graph(1000, 3, 1.5, 0.5, min_community=20, average_degree=5) >>> g2 = nx.algorithms.community.LFR_benchmark_graph(1000, 3, 1.5, 0.7, min_community=20, average_degree=5) >>> names = ["g1", "g2"] >>> graphs = [g1, g2] >>> for g in graphs: >>> references.append(NodeClustering(communities={frozenset(g.nodes[v]['community']) for v in g}, graph=g, method_name="reference")) >>> algos = [algorithms.crisp_partition.louvain, algorithms.crisp_partition.label_propagation] >>> viz.plot_scoring(graphs, references, names, algos, nbRuns=2)