class_docstr: Tests for identifying inverse relationships and leakage.
class_docstr_tok: ["Tests","for","identifying","inverse","relationships","and","leakage","."]
docstr: Test :func:`triples_factory_to_sparse_matrices`.
docstr_tok: ["Test",":","func",":","`","triples_factory_to_sparse_matrices","`","."]
code: def test_relations_to_sparse_matrices(self):
      """Test :func:`triples_factory_to_sparse_matrices`."""
      triples_factory = Nations().training
      rel, inv = triples_factory_to_sparse_matrices(triples_factory)
      for m in (rel, inv):
          # check type
          assert isinstance(m, scipy.sparse.spmatrix)
          assert m.dtype == numpy.int32
          # check shape
          assert m.shape[0] == triples_factory.num_relations
          # check 1-hot
          assert m.max() == 1
  
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 4 for calling the TestLeakage obj's underlying member method code with example usage: obj.test_relations_to_sparse_matrices() without return types