class_docstr: An implementation of RESCAL from [nickel2011]_.
  
  This model represents relations as matrices and models interactions between latent features.
  
  RESCAL is a bilinear model that models entities as vectors and relations as matrices.
  The relation matrices $\textbf{W}_{r} \in \mathbb{R}^{d \times d}$ contain weights $w_{i,j}$ that
  capture the amount of interaction between the $i$-th latent factor of $\textbf{e}_h \in \mathbb{R}^{d}$ and the
  $j$-th latent factor of $\textbf{e}_t \in \mathbb{R}^{d}$.
  
  Thus, the plausibility score of $(h,r,t) \in \mathbb{K}$ is given by:
  
  .. math::
  
      f(h,r,t) = \textbf{e}_h^{T} \textbf{W}_{r} \textbf{e}_t = \sum_{i=1}^{d}\sum_{j=1}^{d} w_{ij}^{(r)}
      (\textbf{e}_h)_{i} (\textbf{e}_t)_{j}
  ---
  citation:
      author: Nickel
      year: 2011
      link: http://www.cip.ifi.lmu.de/~nickel/data/paper-icml2011.pdf
class_docstr_tok: ["An","implementation","of","RESCAL","from","[","nickel2011","]","_",".","This","model","represents","relations","as","matrices","and","models","interactions","between","latent","features",".","RESCAL","is","a","bilinear","model","that","models","entities","as","vectors","and","relations","as","matrices",".","The","relation","matrices","$","\\textbf","{","W","}","_","{","r","}","\\in","\\mathbb","{","R","}","^","{","d","\\times","d","}","$","contain","weights","$","w_","{","i",",","j","}","$","that","capture","the","amount","of","interaction","between","the","$","i","$","-th","latent","factor","of","$","\\textbf","{","e","}","_h","\\in","\\mathbb","{","R","}","^","{","d","}","$","and","the","$","j","$","-th","latent","factor","of","$","\\textbf","{","e","}","_t","\\in","\\mathbb","{","R","}","^","{","d","}","$",".","Thus",",","the","plausibility","score","of","$","(","h",",","r",",","t",")","\\in","\\mathbb","{","K","}","$","is","given","by",":","..","math",":",":","f","(","h",",","r",",","t",")","=","\\textbf","{","e","}","_h^","{","T","}","\\textbf","{","W","}","_","{","r","}","\\textbf","{","e","}","_t","=","\\sum_","{","i=1","}","^","{","d","}","\\sum_","{","j=1","}","^","{","d","}","w_","{","ij","}","^","{","(","r",")","}","(","\\textbf","{","e","}","_h",")","_","{","i","}","(","\\textbf","{","e","}","_t",")","_","{","j","}","--","-","citation",":","author",":","Nickel","year",":","2011","link",":","http",":","\/\/www.cip.ifi.lmu.de\/~nickel\/data\/paper-icml2011.pdf"]
docstr: Initialize RESCAL.
  
  :param embedding_dim:
      the entity embedding dimension $d$. Is usually $d \in [50, 300]$.
  :param entity_initializer:
      entity initializer function. Defaults to :func:`torch.nn.init.uniform_`
  :param relation_initializer:
      relation initializer function. Defaults to :func:`torch.nn.init.uniform_`
  :param regularizer:
      the regularizer. Default to :attr:`RESCAL.defaul_regularizer`
  :param regularizer_kwargs:
      additional keyword-based parameters for the regularizer
  :param kwargs:
      remaining keyword arguments to forward to :meth:`pykeen.models.ERModel.__init__`
  
  .. seealso::
  
      - OpenKE `implementation of RESCAL <https://github.com/thunlp/OpenKE/blob/master/models/RESCAL.py>`_
docstr_tok: ["Initialize","RESCAL",".",":","param","embedding_dim",":","the","entity","embedding","dimension","$","d","$",".","Is","usually","$","d","\\in","[","50",",","300","]","$",".",":","param","entity_initializer",":","entity","initializer","function",".","Defaults","to",":","func",":","`","torch.nn.init.uniform_","`",":","param","relation_initializer",":","relation","initializer","function",".","Defaults","to",":","func",":","`","torch.nn.init.uniform_","`",":","param","regularizer",":","the","regularizer",".","Default","to",":","attr",":","`","RESCAL.defaul_regularizer","`",":","param","regularizer_kwargs",":","additional","keyword-based","parameters","for","the","regularizer",":","param","kwargs",":","remaining","keyword","arguments","to","forward","to",":","meth",":","`","pykeen.models.ERModel.__init__","`","..","seealso",":",":","-","OpenKE","`","implementation","of","RESCAL","<","https",":","\/\/github.com\/thunlp\/OpenKE\/blob\/master\/models\/RESCAL.py",">","`","_"]
code: def __init__(
      self,
      *,
      embedding_dim: int = 50,
      entity_initializer: Hint[Initializer] = uniform_,
      relation_initializer: Hint[Initializer] = uniform_,
      regularizer: HintOrType[Regularizer] = None,
      regularizer_kwargs: OptionalKwargs = None,
      **kwargs,
  ) -> None:
      r"""Initialize RESCAL.
  
      :param embedding_dim:
          the entity embedding dimension $d$. Is usually $d \in [50, 300]$.
      :param entity_initializer:
          entity initializer function. Defaults to :func:`torch.nn.init.uniform_`
      :param relation_initializer:
          relation initializer function. Defaults to :func:`torch.nn.init.uniform_`
      :param regularizer:
          the regularizer. Default to :attr:`RESCAL.defaul_regularizer`
      :param regularizer_kwargs:
          additional keyword-based parameters for the regularizer
      :param kwargs:
          remaining keyword arguments to forward to :meth:`pykeen.models.ERModel.__init__`
  
      .. seealso::
  
          - OpenKE `implementation of RESCAL <https://github.com/thunlp/OpenKE/blob/master/models/RESCAL.py>`_
      """
      regularizer = self._instantiate_regularizer(
          regularizer=regularizer, regularizer_kwargs=regularizer_kwargs
      )
      super().__init__(
          interaction=RESCALInteraction,
          entity_representations_kwargs=dict(
              shape=embedding_dim,
              initializer=entity_initializer,
              regularizer=regularizer,
          ),
          relation_representations_kwargs=dict(
              shape=(embedding_dim, embedding_dim),  # d x d matrices
              initializer=relation_initializer,
              regularizer=regularizer,
          ),
          **kwargs,
      )
  
file_path: pykeen/src/pykeen/models/unimodal/rescal.py
imports: from typing import Any, ClassVar, Mapping, Type
  from class_resolver import HintOrType, OptionalKwargs
  from torch.nn.init import uniform_
  from ..nbase import ERModel
  from ...constants import DEFAULT_EMBEDDING_HPO_EMBEDDING_DIM_RANGE
  from ...nn import RESCALInteraction
  from ...regularizers import LpRegularizer, Regularizer
  from ...typing import Hint, Initializer
label_desc: Use image node_id 1 to create a new RESCAL object from inherited base classes: ERModel with example: obj = RESCAL()