class_docstr: Metric to keep track of slot F1.
  
  Keeps track of slot precision and slot recall as running metrics.
class_docstr_tok: ["Metric","to","keep","track","of","slot","F1",".","Keeps","track","of","slot","precision","and","slot","recall","as","running","metrics","."]
code: def value(self) -> float:
      if self._slot_p is None or self._slot_r is None:
          return float("nan")
      else:
          slot_p = self._slot_p.value()
          slot_r = self._slot_r.value()
          if slot_p == 0.0 and slot_r == 0.0:
              return float("nan")
          else:
              return 2 * (slot_p * slot_r) / (slot_p + slot_r)
  
file_path: ParlAI/parlai/core/tod/teacher_metrics.py
imports: from typing import Optional, List, Dict, Any
  from parlai.core.metrics import AverageMetric, BleuMetric, F1Metric, Metric, Metrics
label_desc: Use image node_id 4 for calling the SlotF1Metric obj's underlying member method code with example usage: obj.value() and returns: float, float, unknown