class_docstr: Natural language inference scores measure the effect biased associations have on decisions
  made downstream, given neutrally-constructed pairs of sentences differing only in the subject.
  
  1. Net Neutral (NN): The average probability of the neutral label
  across all sentence pairs.
  
  2. Fraction Neutral (FN): The fraction of sentence pairs predicted neutral.
  
  3. Threshold:tau (T:tau): A parameterized measure that reports the fraction
  of examples whose probability of neutral is above tau.
  
  # Parameters
  
  neutral_label : `int`, optional (default=`2`)
      The discrete integer label corresponding to a neutral entailment prediction.
  taus : `List[float]`, optional (default=`[0.5, 0.7]`)
      All the taus for which to compute Threshold:tau.
  
  Based on: Dev, S., Li, T., Phillips, J.M., & Srikumar, V. (2020). [On Measuring and Mitigating
  Biased Inferences of Word Embeddings](https://api.semanticscholar.org/CorpusID:201670701).
  ArXiv, abs/1908.09369.
class_docstr_tok: ["Natural","language","inference","scores","measure","the","effect","biased","associations","have","on","decisions","made","downstream",",","given","neutrally-constructed","pairs","of","sentences","differing","only","in","the","subject",".","1",".","Net","Neutral","(","NN",")",":","The","average","probability","of","the","neutral","label","across","all","sentence","pairs",".","2",".","Fraction","Neutral","(","FN",")",":","The","fraction","of","sentence","pairs","predicted","neutral",".","3",".","Threshold",":","tau","(","T",":","tau",")",":","A","parameterized","measure","that","reports","the","fraction","of","examples","whose","probability","of","neutral","is","above","tau",".","#","Parameters","neutral_label",":","`","int","`",",","optional","(","default=","`","2","`",")","The","discrete","integer","label","corresponding","to","a","neutral","entailment","prediction",".","taus",":","`","List","[","float","]","`",",","optional","(","default=","`","[","0.5",",","0.7","]","`",")","All","the","taus","for","which","to","compute","Threshold",":","tau",".","Based","on",":","Dev",",","S.",",","Li",",","T.",",","Phillips",",","J.M.",",","&","Srikumar",",","V.","(","2020",")",".","[","On","Measuring","and","Mitigating","Biased","Inferences","of","Word","Embeddings","]","(","https",":","\/\/api.semanticscholar.org\/CorpusID:201670701",")",".","ArXiv",",","abs\/1908.09369","."]
docstr: # Returns
  
  nli_scores : `Dict[str, float]`
      Contains the following keys:
  
      1. "`net_neutral`" : The average probability of the neutral label across
      all sentence pairs. A value closer to 1 suggests lower bias, as bias will result in a higher
      probability of entailment or contradiction.
  
      2. "`fraction_neutral`" : The fraction of sentence pairs predicted neutral.
      A value closer to 1 suggests lower bias, as bias will result in a higher
      probability of entailment or contradiction.
  
      3. "`threshold_{taus}`" : For each tau, the fraction of examples whose probability of
      neutral is above tau. For each tau, a value closer to 1 suggests lower bias, as bias
      will result in a higher probability of entailment or contradiction.
docstr_tok: ["#","Returns","nli_scores",":","`","Dict","[","str",",","float","]","`","Contains","the","following","keys",":","1",".","``","`","net_neutral","`","``",":","The","average","probability","of","the","neutral","label","across","all","sentence","pairs",".","A","value","closer","to","1","suggests","lower","bias",",","as","bias","will","result","in","a","higher","probability","of","entailment","or","contradiction",".","2",".","``","`","fraction_neutral","`","``",":","The","fraction","of","sentence","pairs","predicted","neutral",".","A","value","closer","to","1","suggests","lower","bias",",","as","bias","will","result","in","a","higher","probability","of","entailment","or","contradiction",".","3",".","``","`","threshold_","{","taus","}","`","``",":","For","each","tau",",","the","fraction","of","examples","whose","probability","of","neutral","is","above","tau",".","For","each","tau",",","a","value","closer","to","1","suggests","lower","bias",",","as","bias","will","result","in","a","higher","probability","of","entailment","or","contradiction","."]
code: def get_metric(self, reset: bool = False):
      """
      # Returns
  
      nli_scores : `Dict[str, float]`
          Contains the following keys:
  
          1. "`net_neutral`" : The average probability of the neutral label across
          all sentence pairs. A value closer to 1 suggests lower bias, as bias will result in a higher
          probability of entailment or contradiction.
  
          2. "`fraction_neutral`" : The fraction of sentence pairs predicted neutral.
          A value closer to 1 suggests lower bias, as bias will result in a higher
          probability of entailment or contradiction.
  
          3. "`threshold_{taus}`" : For each tau, the fraction of examples whose probability of
          neutral is above tau. For each tau, a value closer to 1 suggests lower bias, as bias
          will result in a higher probability of entailment or contradiction.
  
      """
      if self._total_predictions == 0:
          nli_scores = {
              "net_neutral": 0.0,
              "fraction_neutral": 0.0,
              **{"threshold_{}".format(tau): 0.0 for tau in self.taus},
          }
      else:
          nli_scores = {
              "net_neutral": self._nli_probs_sum
              / self._total_predictions,
              "fraction_neutral": self._num_neutral_predictions
              / self._total_predictions,
              **{
                  "threshold_{}".format(
                      tau
                  ): self._num_neutral_above_taus[tau]
                  / self._total_predictions
                  for tau in self.taus
              },
          }
      if reset:
          self.reset()
      return nli_scores
  
imports: from typing import Optional, Dict, Union, List
  import torch
  import torch.distributed
  from allennlp.common.util import is_distributed
  from allennlp.common.checks import ConfigurationError
  from allennlp.nn.util import dist_reduce_sum
  from allennlp.training.metrics.metric import Metric
label_desc: Use image node_id 3 for calling the NaturalLanguageInference obj's underlying member method code with example usage: obj.get_metric(reset) and returns: nli_scores