NNSOM.som.SOM.cluster_data

SOM.cluster_data(x)[source]

Cluster the input data based on the trained SOM reference vectors.

Parameters:

x (ndarray (normalized)) – The input data to be clustered.

Returns:

  • clusters (list of lists) – A list containing sub-lists, where each sublist represents a cluster. The indices of the input data points belonging to the same cluster are stored in the corresponding sublist, sorted by their proximity to the cluster center.

  • cluster_distances (list of lists) – A list containing sub-lists, where each sublist represents the distances of the input data points to the corresponding cluster center, sorted in the same order as the indices in the clusters list.

  • max_cluster_distances (ndarray) – A list containing the maximum distance between each cluster center and the data points belonging to that cluster.

  • cluster_sizes (ndarray) – A list containing the number of data points in each cluster.

Raises:
  • ValueError – If the SOM has not been trained.

  • ValueError – If the number of features in the input data and the SOM weights do not match.