majortrack.similarities¶
- group_similarity_fraction(from_group, to_group)[source]¶
Fraction of nodes present in one group that come from the another group.
- group_similarity_jaccard(group_1, group_2, N=None)[source]¶
Compute the similarity, i.e. the fraction of agreeing nodes, between two groups of different groupings.
The similarity is given by 1 - the fraction of nodes belonging to the symmetric difference (or disjunctive union) between the two groups. Or, said differently, the fraction of nodes that agree on their respective status towards both provided groups. The status of a node towards a group can either be member or non-member of that group. A node with identical status towards both groups contributes with a summand of 1/N to the similarity of those two groups.
If the total size of the networks, N, is provided, then also nodes contribute to the similarity of the groups which are non-members for both of the groups. Without the total size of the network, N=None, the groups similarity only considers nodes present in both groups as contributing to the similarity and thus is equivalent to the Jaccard index.
- group_1: set
members of a group
- group_2: set
members of another group
- N: int (default=None)
Number of nodes in the network. If not provided, then the Jaccard index is computed.