Internal function to select optimal k

.select_optimal_k(
  pc_scores,
  k_range,
  method,
  nstart,
  iter.max,
  algorithm,
  silhouette_max_cells = Inf
)