code: def get_relation_similarity(
      triples_factory: CoreTriplesFactory,
      threshold: Optional[float] = None,
  ) -> Tuple[scipy.sparse.csr_matrix, scipy.sparse.csr_matrix]:
      """
      Compute Jaccard similarity of relations' (and their inverse's) entity-pair sets.
  
      :param triples_factory:
          the triples factory
      :param threshold:
          an absolute sparsification threshold.
  
      :return: shape: (num_relations, num_relations)
          a pair of similarity matrices.
      """
      r, r_inv = triples_factory_to_sparse_matrices(
          triples_factory=triples_factory
      )
      sim, sim_inv = [
          sparsify(jaccard_similarity_scipy(r, r2), threshold=threshold)
          for r2 in (r, r_inv)
      ]
      return sim, sim_inv
  
file_path: pykeen/src/pykeen/models/baseline/utils.py
imports: from typing import Optional, Tuple
  import numpy
  import scipy.sparse
  import torch
  from sklearn.preprocessing import normalize
  from ...triples import CoreTriplesFactory
  from ...triples.leakage import jaccard_similarity_scipy, triples_factory_to_sparse_matrices
label_desc: Use image node_id 4 for calling a global function with example usage: get_relation_similarity(triples_factory, threshold) and returns: sim,  sim_inv