snf.compute.get_n_clusters

snf.compute.get_n_clusters(arr, n_clusters=range(2, 6))[source]

Finds optimal number of clusters in arr via eigengap method

Parameters:
  • arr ((N, N) array_like) – Input array (e.g., the output of :py:func`snf.compute.snf`)
  • n_clusters (array_like) – Numbers of clusters to choose between
Returns:

  • opt_cluster (int) – Optimal number of clusters
  • second_opt_cluster (int) – Second best number of clusters