class_docstr: Score based on relation similarity.
  
  ---
  name: Soft Inverse Triple Baseline
  citation:
      author: Berrendorf
      year: 2021
      link: https://github.com/pykeen/pykeen/pull/543
      github: pykeen/pykeen
docstr: Initialize the model.
  
  :param triples_factory:
      the (training) triples factory
  :param threshold:
      the threshold applied to the similarity matrix, cf. :func:`get_relation_similarity`
docstr_tok: ["Initialize","the","model",".",":","param","triples_factory",":","the","(","training",")","triples","factory",":","param","threshold",":","the","threshold","applied","to","the","similarity","matrix",",","cf",".",":","func",":","`","get_relation_similarity","`"]
code: def __init__(
      self,
      triples_factory: CoreTriplesFactory,
      threshold: Optional[float] = None,
  ):
      """
      Initialize the model.
  
      :param triples_factory:
          the (training) triples factory
      :param threshold:
          the threshold applied to the similarity matrix, cf. :func:`get_relation_similarity`
      """
      super().__init__(triples_factory=triples_factory)
      # compute relation similarity matrix
      self.sim, self.sim_inv = get_relation_similarity(
          triples_factory, threshold=threshold
      )
      # mapping from relations to head/tail entities
      h, r, t = numpy.asarray(triples_factory.mapped_triples).T
      self.rel_to_head, self.rel_to_tail = [
          get_csr_matrix(
              row_indices=r,
              col_indices=col_indices,
              shape=(
                  triples_factory.num_relations,
                  triples_factory.num_entities,
              ),
          )
          for col_indices in (h, t)
      ]
  
imports: from typing import Optional
  import numpy
  import torch
  from .utils import get_csr_matrix, get_relation_similarity, marginal_score
  from ..base import Model
  from ...triples import CoreTriplesFactory
  from ...typing import InductiveMode
label_desc: Use image node_id 1 to create a new SoftInverseTripleBaseline object from inherited base classes: EvaluationOnlyModel with example: obj = SoftInverseTripleBaseline(triples_factory, threshold)