cdlib.viz.plot_scoring¶
-
plot_scoring
(graphs: list, ref_partitions: object, graph_names: list, methods: list, scoring: Callable[[object, object], object] = <function adjusted_mutual_information>, nbRuns: int = 5) → object¶ Plot the scores obtained by a list of methods on a list of graphs.
Parameters: - graphs – list of graphs on which to make computations
- ref_partitions – list of reference clusterings corresponding to graphs
- graph_names – list of the names of the graphs to display
- methods – list of functions that take a graph as input and return a Clustering as output
- scoring – the scoring function to use, default anmi
- nbRuns – number of runs to do for each method on each graph
Returns: a seaborn lineplot
Example:
>>> 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)