clusters_to_pairs#

er_evaluation.data_structures.clusters_to_pairs(clusters)[source]#

Transform clusters dictionary into pairs list.

Parameters:

clusters (dictionary) – Dictionary mapping cluster identifiers to numpy array of cluster elements.

Returns:

Pairs list.

Examples

>>> from numpy import array
>>> clusters = {1: array([1, 2]), 2: array([3, 5]), 3: array([4]), 4: array([6, 7, 8])}
>>> clusters_to_pairs(clusters)
array([[1, 2],
       [3, 5],
       [6, 7],
       [6, 8],
       [7, 8]])