code: def iter_relation_cardinality_types(
      mapped_triples: Collection[Tuple[int, int, int]],
  ) -> Iterable[PatternMatch]:
      """Iterate over relation-cardinality types.
  
      :param mapped_triples:
          A collection of ID-based triples.
  
      :yields: A pattern match tuple of relation_id, pattern_type, support, and confidence.
      """
      it = _help_iter_relation_cardinality_types(mapped_triples)
      for (
          relation,
          support,
          head_injective_conf,
          tail_injective_conf,
      ) in it:
          yield PatternMatch(
              relation,
              CARDINALITY_TYPE_ONE_TO_ONE,
              support,
              head_injective_conf * tail_injective_conf,
          )
          yield PatternMatch(
              relation,
              CARDINALITY_TYPE_ONE_TO_MANY,
              support,
              (1 - head_injective_conf) * tail_injective_conf,
          )
          yield PatternMatch(
              relation,
              CARDINALITY_TYPE_MANY_TO_ONE,
              support,
              head_injective_conf * (1 - tail_injective_conf),
          )
          yield PatternMatch(
              relation,
              CARDINALITY_TYPE_MANY_TO_MANY,
              support,
              (1 - head_injective_conf) * (1 - tail_injective_conf),
          )
  
imports: import hashlib
  import itertools
  import logging
  from collections import defaultdict
  from typing import Collection, DefaultDict, Iterable, Mapping, NamedTuple, Optional, Sequence, Set, Tuple, Union
  import numpy
  import pandas
  from tqdm.auto import tqdm
  from .None import TriplesFactory
  from ..constants import COLUMN_LABELS, TARGET_TO_INDEX
  from ..typing import COLUMN_HEAD, COLUMN_RELATION, COLUMN_TAIL, LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, MappedTriples
label_desc: Use image node_id 14 for calling a global function with example usage: iter_relation_cardinality_types(mapped_triples) without return types