class_docstr: Stores inverse frequencies and inverse mappings in a given triples factory.
class_docstr_tok: ["Stores","inverse","frequencies","and","inverse","mappings","in","a","given","triples","factory","."]
docstr: Index the inverse frequencies and the inverse relations in the triples factory.
  
  :param triples_factory: The triples factory to index.
  :param minimum_frequency: The minimum overlap between two relations' triples to consider them as inverses. The
      default value, 0.97, is taken from `Toutanova and Chen (2015)
      <https://www.aclweb.org/anthology/W15-4007/>`_, who originally described the generation of FB15k-237.
  :param symmetric: If the similarities are computed as symmetric
  :raises NotImplementedError:
      If symmetric is False
docstr_tok: ["Index","the","inverse","frequencies","and","the","inverse","relations","in","the","triples","factory",".",":","param","triples_factory",":","The","triples","factory","to","index",".",":","param","minimum_frequency",":","The","minimum","overlap","between","two","relations","'","triples","to","consider","them","as","inverses",".","The","default","value",",","0.97",",","is","taken","from","`","Toutanova","and","Chen","(","2015",")","<","https",":","\/\/www.aclweb.org\/anthology\/W15-4007\/",">","`","_",",","who","originally","described","the","generation","of","FB15k-237",".",":","param","symmetric",":","If","the","similarities","are","computed","as","symmetric",":","raises","NotImplementedError",":","If","symmetric","is","False"]
code: def __init__(
      self,
      triples_factory: CoreTriplesFactory,
      minimum_frequency: Optional[float] = None,
      symmetric: bool = True,
  ):
      """Index the inverse frequencies and the inverse relations in the triples factory.
  
      :param triples_factory: The triples factory to index.
      :param minimum_frequency: The minimum overlap between two relations' triples to consider them as inverses. The
          default value, 0.97, is taken from `Toutanova and Chen (2015)
          <https://www.aclweb.org/anthology/W15-4007/>`_, who originally described the generation of FB15k-237.
      :param symmetric: If the similarities are computed as symmetric
      :raises NotImplementedError:
          If symmetric is False
      """
      self.triples_factory = triples_factory
      if minimum_frequency is None:
          minimum_frequency = 0.97
      self.minimum_frequency = minimum_frequency
  
      # compute similarities
      if symmetric:
          rel, inv = triples_factory_to_sparse_matrices(
              triples_factory=triples_factory
          )
          self.candidate_duplicate_relations = get_candidate_pairs(
              a=rel, threshold=self.minimum_frequency
          )
          self.candidate_inverse_relations = get_candidate_pairs(
              a=rel, b=inv, threshold=self.minimum_frequency
          )
      else:
          raise NotImplementedError
      logger.info(
          f"identified {len(self.candidate_duplicate_relations)} candidate duplicate relationships"
          f" at similarity > {self.minimum_frequency} in {self.triples_factory}.",
      )
      logger.info(
          f"identified {len(self.candidate_inverse_relations)} candidate inverse pairs"
          f" at similarity > {self.minimum_frequency} in {self.triples_factory}",
      )
      self.candidates = set(self.candidate_duplicate_relations).union(
          self.candidate_inverse_relations
      )
      sizes = dict(
          zip(
              *triples_factory.mapped_triples[:, 1].unique(
                  return_counts=True
              )
          )
      )
      self.relations_to_delete = _select_by_most_pairs(
          size=sizes,
          components=get_connected_components(
              (a, b) for a, b in self.candidates if a != b
          ),
      )
      logger.info(
          f"identified {len(self.candidates)} from {self.triples_factory} to delete"
      )
  
imports: import logging
  from typing import Collection, Iterable, List, Mapping, Optional, Set, Tuple, TypeVar, Union, cast
  import click
  import numpy
  import scipy.sparse
  import torch
  from pykeen.datasets.base import EagerDataset
  from pykeen.triples.triples_factory import CoreTriplesFactory, TriplesFactory, cat_triples
  from pykeen.typing import MappedTriples
  from pykeen.utils import compact_mapping, get_connected_components
label_desc: Use image node_id 1 to create a new Sealant object  with example: obj = Sealant(triples_factory, minimum_frequency, symmetric)