cdlib.evaluation.fowlkes_mallows_index

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

This function calculates the Fowlkes and Mallows index between two clusterings

\[FM = \frac{N11}{ \sqrt{ (N11 + N10) * (N11 + 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.fowlkes_mallows_index(louvain_communities,leiden_communities)
Reference:

Edward B. Fowlkes and Colin L. Mallows. A method for comparing two hierarchical clusterings. Journal of the American Statistical Association, 78(383):553–569, 1983.

Note

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