topologic.similarity package

topologic.similarity.ari(primary_partition: Dict[Any, int], test_partition: Dict[Any, int]) → float[source]

Given two partition schemas, a primary partition mapping (the most accurate representation of truth) and the test partition mapping (to be scored against that accurate representation of truth), calculate the Adjusted Rand Index.

See https://en.wikipedia.org/wiki/Rand_index

Parameters:
  • int] primary_partition (Dict[Any,) – The most accurate representation of truth for cluster or community membership of nodes. The keys are vertex labels and the values are the cluster/community/partition labels.
  • int] test_partition (Dict[Any,) – The partition mapping to compare against the primary partition. The keys are vertex labels and the values are the cluster/community/partition labels.
Returns:

The adjusted rand index for the two mappings

Rtype float:
Raises:

ValueError – If the primary partition and test partition do not have an identical vertex label set.