class_docstr: Normalized Maximum Eigengap based Spectral Clustering (NME-SC)
  uses Eigengap analysis to get an estimated p-value for
  affinity binarization and an estimated number of speakers.
  
  p_value (also referred to as p_neighbors) is for taking
  top p number of affinity values and convert those to 1 while
  convert the rest of values to 0.
  
  p_value can be also tuned on a development set without performing
  NME-analysis. Fixing p_value brings about significantly faster clustering
  speed, but the performance is limited to the development set.
  
  References:
      Tae Jin Park et al., Auto-Tuning Spectral Clustering for Speaker Diarization
      Using Normalized Maximum Eigengap, IEEE Signal Processing Letters 27 (2019),
      https://arxiv.org/abs/2003.02405
  
  Args:
      Please refer to def __init__().
  
  Methods:
      NMEanalysis():
          Performs NME-analysis to estimate p_value and the number of speakers
      subsampleAffinityMat(nme_mat_size):
          Subsamples the number of speakers to reduce the computational load
      getPvalueList():
          Generates a list containing p-values that need to be examined.
      getEigRatio(p_neighbors):
          Calculates g_p, which is a ratio between p_neighbors and the maximum eigengap
      getLamdaGaplist(lambdas):
          Calculates lambda gap values from an array contains lambda values
      estimateNumofSpeakers(affinity_mat):
          Estimates the number of speakers using lambda gap list
class_docstr_tok: ["Normalized","Maximum","Eigengap","based","Spectral","Clustering","(","NME-SC",")","uses","Eigengap","analysis","to","get","an","estimated","p-value","for","affinity","binarization","and","an","estimated","number","of","speakers",".","p_value","(","also","referred","to","as","p_neighbors",")","is","for","taking","top","p","number","of","affinity","values","and","convert","those","to","1","while","convert","the","rest","of","values","to","0.","p_value","can","be","also","tuned","on","a","development","set","without","performing","NME-analysis",".","Fixing","p_value","brings","about","significantly","faster","clustering","speed",",","but","the","performance","is","limited","to","the","development","set",".","References",":","Tae","Jin","Park","et","al.",",","Auto-Tuning","Spectral","Clustering","for","Speaker","Diarization","Using","Normalized","Maximum","Eigengap",",","IEEE","Signal","Processing","Letters","27","(","2019",")",",","https",":","\/\/arxiv.org\/abs\/2003.02405","Args",":","Please","refer","to","def","__init__","(",")",".","Methods",":","NMEanalysis","(",")",":","Performs","NME-analysis","to","estimate","p_value","and","the","number","of","speakers","subsampleAffinityMat","(","nme_mat_size",")",":","Subsamples","the","number","of","speakers","to","reduce","the","computational","load","getPvalueList","(",")",":","Generates","a","list","containing","p-values","that","need","to","be","examined",".","getEigRatio","(","p_neighbors",")",":","Calculates","g_p",",","which","is","a","ratio","between","p_neighbors","and","the","maximum","eigengap","getLamdaGaplist","(","lambdas",")",":","Calculates","lambda","gap","values","from","an","array","contains","lambda","values","estimateNumofSpeakers","(","affinity_mat",")",":","Estimates","the","number","of","speakers","using","lambda","gap","list"]
docstr: For a given p_neighbors value, calculate g_p, which is a ratio between p_neighbors and the
  maximum eigengap values.
  References:
      Tae Jin Park et al., Auto-Tuning Spectral Clustering for Speaker Diarization Using
      Normalized Maximum Eigengap, IEEE Signal Processing Letters 27 (2019),
      https://arxiv.org/abs/2003.02405
  
  Args:
      p_neighbors (int):
          Determines how many binary graph connections we want to keep for each row.
  
  Returns:
      est_num_of_spk (int):
          Estimated number of speakers
      g_p (float):
          The ratio between p_neighbors value and the maximum eigen gap value.
code: def getEigRatio(self, p_neighbors: int) -> torch.Tensor:
      """
      For a given p_neighbors value, calculate g_p, which is a ratio between p_neighbors and the
      maximum eigengap values.
      References:
          Tae Jin Park et al., Auto-Tuning Spectral Clustering for Speaker Diarization Using
          Normalized Maximum Eigengap, IEEE Signal Processing Letters 27 (2019),
          https://arxiv.org/abs/2003.02405
  
      Args:
          p_neighbors (int):
              Determines how many binary graph connections we want to keep for each row.
  
      Returns:
          est_num_of_spk (int):
              Estimated number of speakers
          g_p (float):
              The ratio between p_neighbors value and the maximum eigen gap value.
      """
      affinity_mat = getAffinityGraphMat(self.mat, p_neighbors)
      est_num_of_spk, lambdas, lambda_gap_list = estimateNumofSpeakers(
          affinity_mat, self.max_num_speakers, self.cuda
      )
      arg_sorted_idx = torch.argsort(
          lambda_gap_list[: self.max_num_speakers], descending=True
      )
      max_key = arg_sorted_idx[0]
      max_eig_gap = lambda_gap_list[max_key] / (
          torch.max(lambdas).item() + self.eps
      )
      g_p = (p_neighbors / self.mat.shape[0]) / (max_eig_gap + self.eps)
      return torch.stack([g_p, est_num_of_spk])
  
imports: from typing import Dict, List, Tuple
  import torch
  from torch.linalg import eigh, eigvalsh
label_desc: Use image node_id 4 for calling the NMESC obj's underlying member method code with example usage: obj.getEigRatio(p_neighbors) and returns: torch