snf.cv.get_optimal_params

snf.cv.get_optimal_params(zaff, labels, neighbors='edges')[source]

Finds optimal parameters for SNF based on K-folds grid search

Parameters:
  • zaff ((F,) list of (S, K, C) np.ndarray) – Where S is mu, K is K, C is n_clusters, and F is the number of folds for CV. The entries in the individual arrays correspond to the z-scored silhouette (affinity).
  • labels ((F,) list of (S, K, C, N) np.ndarray) – Where S is mu, K is K, C is n_clusters, and F is the number of folds for CV. The N entries along the last dimension correspond to the cluster labels for the given parameter combination.
  • neighbors (str, optional) – How many neighbors to consider when calculating z-Rand kernel. Must be in [‘edges’, ‘corners’]. Default: ‘edges’
Returns:

  • mu (int) – Index along S indicating optimal mu parameter
  • K (int) – Index along K indicating optimal K parameter