code: def get_cardinality_factor(
      overlap_count, cardinality_bias: Optional[str] = None
  ):
      """Cardinalty factor used to penalize the overlap size & positional reward.
  
      Parameters
      ----------
      overlap_count : array-like, 1-D
          Accumulator used to keep track of how of overlaps between an anomaly range and a set of anomaly ranges.
      cardinality_bias: `str` or None, default None
          In the overlap reward, this is a penalization factor. If None, no cardinality penalty will be applied. If "reciprocal", the
          overlap reward will be penalized as it gets multiplied by the reciprocal of the number of detected anomaly ranges overlapping
          with the predicted anomaly range.
  
      Returns
      -------
      cardinality_factor: `float`
          A multiplying factor used to penalize higher cardinality: the number of overlaps of
          predicted anomaly ranges with a real anomaly range, and vice versa.
      """
  
      if cardinality_bias is not None:
          assert cardinality_bias == "reciprocal"
  
      overlap = overlap_count[0]
      assert overlap >= 0
  
      cardinality_factor = 1.0
  
      if cardinality_bias == "reciprocal" and overlap > 1:
          cardinality_factor /= overlap
  
      return cardinality_factor
  
file_path: greykite/greykite/detection/common/ad_evaluation_utils.py
imports: from typing import List
  from typing import Optional
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: get_cardinality_factor(overlap_count, cardinality_bias) and returns: cardinality_factor