code: def NME_SpectralClustering(
      A, num_clusters=None, max_num_clusters=10, pbest=0, pmax=20
  ):
      if pbest == 0:
          print(
              "Selecting best number of neighbors for affinity matrix thresolding:"
          )
          rbest = None
          kbest = None
          for p in range(2, pmax + 1):
              e, g, k, r = ComputeNMEParameters(A, p, max_num_clusters)
              print("p={}, r={}".format(p, r))
              if rbest is None or rbest > r:
                  rbest = r
                  pbest = p
                  kbest = k
          print("Best number of neighbors is {}".format(pbest))
          return NME_SpectralClustering_sklearn(
              A,
              num_clusters if num_clusters is not None else (kbest + 1),
              pbest,
          )
      if num_clusters is None:
          print("Compute number of clusters to generate:")
          e, g, r, k = ComputeNMEParameters(A, p)
          print("Number of clusters to generate is {}".format(k + 1))
          return NME_SpectralClustering_sklearn(A, k + 1, pbest)
      return NME_SpectralClustering_sklearn(A, num_clusters, pbest)
  
file_path: espnet/egs/libri_css/asr1/diarization/spec_clust.py
imports: import argparse
  import numpy
  import scipy
  from kaldiio import ReadHelper
  from sklearn.cluster import SpectralClustering
label_desc: Use image node_id 10 for calling a global function with example usage: NME_SpectralClustering(A, num_clusters, max_num_clusters, pbest, pmax) and returns: NME_SpectralClustering_sklearn, NME_SpectralClustering_sklearn, NME_SpectralClustering_sklearn