NNSOM.utils.get_color_labels

NNSOM.utils.get_color_labels(clust, *listOfIndices)[source]

Generate a colour label per cluster based on majority class membership.

When a single class index array is provided, clusters where that class is the majority are labelled 1; others are labelled 0. When multiple arrays are provided, each cluster is labelled with the index of the class that has the most members in it.

Parameters:
  • clust (list of array-like) – A list of cluster index arrays.

  • *listOfIndices (array-like of int) – One array per class holding data-point indices for that class. At least one array is required.

Returns:

color_labels – Integer colour label for each cluster. None for empty clusters.

Return type:

np.ndarray, shape (numNeurons,)

Raises:

ValueError – If no class index arrays are provided, or if any argument is not a list or np.ndarray.