class_docstr: This `Metric` calculates the sample Spearman correlation coefficient (r)
  between two tensors. Each element in the two tensors is assumed to be
  a different observation of the variable (i.e., the input tensors are
  implicitly flattened into vectors and the correlation is calculated
  between the vectors).
  
  <https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient>
class_docstr_tok: ["This","`","Metric","`","calculates","the","sample","Spearman","correlation","coefficient","(","r",")","between","two","tensors",".","Each","element","in","the","two","tensors","is","assumed","to","be","a","different","observation","of","the","variable","(","i.e.",",","the","input","tensors","are","implicitly","flattened","into","vectors","and","the","correlation","is","calculated","between","the","vectors",")",".","<","https",":","\/\/en.wikipedia.org\/wiki\/Spearman","%","27s_rank_correlation_coefficient",">"]
docstr: # Returns
  
  The accumulated sample Spearman correlation.
docstr_tok: ["#","Returns","The","accumulated","sample","Spearman","correlation","."]
code: def get_metric(self, reset: bool = False):
      """
      # Returns
  
      The accumulated sample Spearman correlation.
      """
  
      spearman_correlation = stats.spearmanr(
          self.total_predictions.cpu().numpy(),
          self.total_gold_labels.cpu().numpy(),
      )
      if reset:
          self.reset()
  
      return spearman_correlation[0]
  
file_path: allennlp/allennlp/training/metrics/spearman_correlation.py
imports: from typing import Optional
  import torch
  import torch.distributed
  import scipy.stats
  from allennlp.common.util import is_distributed
  from allennlp.training.metrics.metric import Metric
label_desc: Use image node_id 3 for calling the SpearmanCorrelation obj's underlying member method code with example usage: obj.get_metric(reset) and returns: spearman_correlation