class_docstr: Tests for identifying inverse relationships and leakage.
class_docstr_tok: ["Tests","for","identifying","inverse","relationships","and","leakage","."]
docstr: Test :func:`jaccard_similarity_scipy`.
docstr_tok: ["Test",":","func",":","`","jaccard_similarity_scipy","`","."]
code: def test_jaccard_similarity_scipy(self):
      """Test :func:`jaccard_similarity_scipy`."""
      triples_factory = Nations().training
      rel, inv = triples_factory_to_sparse_matrices(triples_factory)
      sim = jaccard_similarity_scipy(a=rel, b=rel)
      # check type
      assert isinstance(sim, numpy.ndarray)
      assert sim.dtype == numpy.float64
      # check shape
      assert sim.shape == (
          triples_factory.num_relations,
          triples_factory.num_relations,
      )
      # check value range
      assert (sim >= 0).all()
      assert (sim <= 1).all()
      # check self-similarity = 1
      numpy.testing.assert_allclose(numpy.diag(sim), 1.0)
  
file_path: pykeen/tests/test_leakage.py
imports: import itertools
  import unittest
  import numpy
  import numpy
  import scipy.sparse
  import torch
  from pykeen.datasets import Nations
  from pykeen.triples import TriplesFactory
  from pykeen.triples.leakage import Sealant, _generate_compact_vectorized_lookup, _translate_triples, get_candidate_pairs, jaccard_similarity_scipy, mapped_triples_to_sparse_matrices, triples_factory_to_sparse_matrices
label_desc: Use image node_id 5 for calling the TestLeakage obj's underlying member method code with example usage: obj.test_jaccard_similarity_scipy() without return types