cdlib.evaluation.sorensen_index

cdlib.evaluation.sorensen_index(first_partition: object, second_partition: object) MatchingResult

This function calculates the Sorensen between two clusterings.

Also known as: Czekanowski index Dice index

\[F = \frac{2*N11}{(2*N11 + N10 + N01)}\]
Parameters:
  • first_partition – NodeClustering object

  • second_partition – NodeClustering object

Returns:

MatchingResult object

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.sorensen_index(louvain_communities,leiden_communities)

Note

The function requires the clusim library to be installed. You can install it via pip: pip install clusim