NNSOM.utils.cal_class_cluster_intersect

NNSOM.utils.cal_class_cluster_intersect(clust, *args)[source]

Calculate the intersection sizes of each class with each neuron cluster.

Parameters:
  • clust (list of list of int) – A collection of neuron clusters; each element is a list of data-point indices assigned to that neuron.

  • *args (array-like of int) – One array per class, each holding the data-point indices that belong to that class.

Returns:

cluster_sizes_matrix – Entry [i, j] is the number of data points in class j that are also in neuron cluster i.

Return type:

np.ndarray, shape (numNeurons, numClasses)

Examples

>>> clust = [[4, 5, 9], [1, 7], [2, 10, 11], [3, 6, 8]]
>>> ind1 = np.array([1, 2, 3])
>>> ind2 = np.array([4, 5, 6])
>>> ind3 = np.array([7, 8, 9])
>>> ind4 = np.array([10, 11, 12])
>>> cal_class_cluster_intersect(clust, ind1, ind2, ind3, ind4)
array([[0, 2, 1, 0],
       [1, 0, 1, 0],
       [1, 0, 0, 2],
       [1, 1, 1, 0]])