pairs_to_membership#

er_evaluation.data_structures.pairs_to_membership(pairs, indices)[source]#

Transform pairs list into membership vector.

Parameters:
  • pairs (ndarray) – array of paired elements.

  • indices (ndarray) – flat array of all elements to consider (paired and non-paired), including singletons.

Returns:

Membership vector

Examples

>>> from numpy import array
>>> pairs = array([[1, 2], [3, 5], [6, 7], [6, 8], [7, 8]])
>>> indices = array([1,2,3,4,5,6,7,8])
>>> pairs_to_membership(pairs, indices)
1    0
2    0
3    1
4    2
5    1
6    3
7    3
8    3
dtype: int64