class_docstr: An implementation of QuatE from [zhang2019]_.
  
  QuatE uses hypercomplex valued representations for the
  entities and relations. Entities and relations are represented as vectors
  $\textbf{e}_i, \textbf{r}_i \in \mathbb{H}^d$, and the plausibility score is computed using the
  quaternion inner product.
  
  .. seealso ::
  
      Official implementation: https://github.com/cheungdaven/QuatE/blob/master/models/QuatE.py
  ---
  citation:
      author: Zhang
      year: 2019
      link: https://arxiv.org/abs/1904.10281
      github: cheungdaven/quate
class_docstr_tok: ["An","implementation","of","QuatE","from","[","zhang2019","]","_.","QuatE","uses","hypercomplex","valued","representations","for","the","entities","and","relations",".","Entities","and","relations","are","represented","as","vectors","$","\\textbf","{","e","}","_i",",","\\textbf","{","r","}","_i","\\in","\\mathbb","{","H","}","^d","$",",","and","the","plausibility","score","is","computed","using","the","quaternion","inner","product",".","..","seealso",":",":","Official","implementation",":","https",":","\/\/github.com\/cheungdaven\/QuatE\/blob\/master\/models\/QuatE.py","--","-","citation",":","author",":","Zhang","year",":","2019","link",":","https",":","\/\/arxiv.org\/abs\/1904.10281","github",":","cheungdaven\/quate"]
docstr: Initialize QuatE.
  
  .. note ::
      The default parameters correspond to the first setting for FB15k-237 described from [zhang2019]_.
  
  :param embedding_dim:
      The embedding dimensionality of the entity embeddings.
  
      .. note ::
          The number of parameter per entity is `4 * embedding_dim`, since quaternion are used.
  
  :param entity_initializer:
      The initializer to use for the entity embeddings.
  :param entity_regularizer:
      The regularizer to use for the entity embeddings.
  :param entity_regularizer_kwargs:
      The keyword arguments passed to the entity regularizer. Defaults to
      :data:`QuatE.regularizer_default_kwargs` if not specified.
  :param relation_initializer:
      The initializer to use for the relation embeddings.
  :param relation_regularizer:
      The regularizer to use for the relation embeddings.
  :param relation_regularizer_kwargs:
      The keyword arguments passed to the relation regularizer. Defaults to
      :data:`QuatE.regularizer_default_kwargs` if not specified.
  :param relation_normalizer:
      The normalizer to use for the relation embeddings.
  :param kwargs:
      Additional keyword based arguments passed to :class:`pykeen.models.ERModel`. Must not contain
      "interaction", "entity_representations", or "relation_representations".
docstr_tok: ["Initialize","QuatE",".","..","note",":",":","The","default","parameters","correspond","to","the","first","setting","for","FB15k-237","described","from","[","zhang2019","]","_.",":","param","embedding_dim",":","The","embedding","dimensionality","of","the","entity","embeddings",".","..","note",":",":","The","number","of","parameter","per","entity","is","`","4","*","embedding_dim","`",",","since","quaternion","are","used",".",":","param","entity_initializer",":","The","initializer","to","use","for","the","entity","embeddings",".",":","param","entity_regularizer",":","The","regularizer","to","use","for","the","entity","embeddings",".",":","param","entity_regularizer_kwargs",":","The","keyword","arguments","passed","to","the","entity","regularizer",".","Defaults","to",":","data",":","`","QuatE.regularizer_default_kwargs","`","if","not","specified",".",":","param","relation_initializer",":","The","initializer","to","use","for","the","relation","embeddings",".",":","param","relation_regularizer",":","The","regularizer","to","use","for","the","relation","embeddings",".",":","param","relation_regularizer_kwargs",":","The","keyword","arguments","passed","to","the","relation","regularizer",".","Defaults","to",":","data",":","`","QuatE.regularizer_default_kwargs","`","if","not","specified",".",":","param","relation_normalizer",":","The","normalizer","to","use","for","the","relation","embeddings",".",":","param","kwargs",":","Additional","keyword","based","arguments","passed","to",":","class",":","`","pykeen.models.ERModel","`",".","Must","not","contain","``","interaction","''",",","``","entity_representations","''",",","or","``","relation_representations","''","."]
code: def __init__(
      self,
      *,
      embedding_dim: int = 100,
      entity_initializer: Hint[Initializer] = init_quaternions,
      entity_regularizer: Hint[Regularizer] = LpRegularizer,
      entity_regularizer_kwargs: Optional[Mapping[str, Any]] = None,
      relation_initializer: Hint[Initializer] = init_quaternions,
      relation_regularizer: Hint[Regularizer] = LpRegularizer,
      relation_regularizer_kwargs: Optional[Mapping[str, Any]] = None,
      relation_normalizer: Hint[Constrainer] = quaternion_normalizer,
      **kwargs,
  ) -> None:
      """Initialize QuatE.
  
      .. note ::
          The default parameters correspond to the first setting for FB15k-237 described from [zhang2019]_.
  
      :param embedding_dim:
          The embedding dimensionality of the entity embeddings.
  
          .. note ::
              The number of parameter per entity is `4 * embedding_dim`, since quaternion are used.
  
      :param entity_initializer:
          The initializer to use for the entity embeddings.
      :param entity_regularizer:
          The regularizer to use for the entity embeddings.
      :param entity_regularizer_kwargs:
          The keyword arguments passed to the entity regularizer. Defaults to
          :data:`QuatE.regularizer_default_kwargs` if not specified.
      :param relation_initializer:
          The initializer to use for the relation embeddings.
      :param relation_regularizer:
          The regularizer to use for the relation embeddings.
      :param relation_regularizer_kwargs:
          The keyword arguments passed to the relation regularizer. Defaults to
          :data:`QuatE.regularizer_default_kwargs` if not specified.
      :param relation_normalizer:
          The normalizer to use for the relation embeddings.
      :param kwargs:
          Additional keyword based arguments passed to :class:`pykeen.models.ERModel`. Must not contain
          "interaction", "entity_representations", or "relation_representations".
      """
      super().__init__(
          interaction=QuatEInteraction,
          entity_representations_kwargs=dict(
              shape=(embedding_dim, 4),  # quaternions
              initializer=entity_initializer,
              dtype=torch.float,
              regularizer=entity_regularizer,
              regularizer_kwargs=entity_regularizer_kwargs
              or self.regularizer_default_kwargs,
          ),
          relation_representations_kwargs=dict(
              shape=(embedding_dim, 4),  # quaternions
              initializer=relation_initializer,
              normalizer=relation_normalizer,
              dtype=torch.float,
              regularizer=relation_regularizer,
              regularizer_kwargs=relation_regularizer_kwargs
              or self.regularizer_default_kwargs,
          ),
          **kwargs,
      )
  
file_path: pykeen/src/pykeen/models/unimodal/quate.py
imports: from typing import Any, ClassVar, Mapping, Optional, Type
  import torch
  from torch.nn import functional
  from ..nbase import ERModel
  from ...constants import DEFAULT_EMBEDDING_HPO_EMBEDDING_DIM_RANGE
  from ...losses import BCEWithLogitsLoss, Loss
  from ...nn.init import init_quaternions
  from ...nn.modules import QuatEInteraction
  from ...regularizers import LpRegularizer, Regularizer
  from ...typing import Constrainer, Hint, Initializer
  from ...utils import get_expected_norm
label_desc: Use image node_id 1 to create a new QuatE object from inherited base classes: ERModel with example: obj = QuatE()