docstr: Embed a graph using a relational graph convolutional network (RGCN),
  and return a new graphistry graph with the embeddings as node
  attributes.
  
  
  Parameters
  ----------
  relation : str
      column to use as relation between nodes
  proto : ProtoSymbolic
      metric to use, ['TransE', 'RotateE', 'DistMult'] or provide your own. Defaults to 'DistMult'.
  embedding_dim : int
      relation embedding dimension. defaults to 32
  use_feat : bool
      wether to featurize nodes, if False will produce random embeddings and shape them during training.
      Defaults to True
  X : XSymbolic
      Which columns in the nodes dataframe to featurize. Inherets args from graphistry.featurize().
      Defaults to None.
  epochs : int
      Number of training epochs. Defaults to 2
  batch_size : int
      batch_size. Defaults to 32
  train_split : Union[float, int]
      train percentage, between 0, 1. Defaults to 0.8.
  sample_size : int
      sample size. Defaults to 1000
  num_steps : int
      num_steps. Defaults to 50
  lr : float
      learning rate. Defaults to 0.002
  inplace : Optional[bool]
      inplace
  device : Optional[str]
      accelarator. Defaults to "cpu"
  evaluate : bool
      Whether to evaluate. Defaults to False.
  
  Returns
  -------
      self : graphistry instance
docstr_tok: ["Embed","a","graph","using","a","relational","graph","convolutional","network","(","RGCN",")",",","and","return","a","new","graphistry","graph","with","the","embeddings","as","node","attributes",".","Parameters","--","--","--","--","--","relation",":","str","column","to","use","as","relation","between","nodes","proto",":","ProtoSymbolic","metric","to","use",",","[","'TransE","'",",","'RotateE","'",",","'DistMult","'","]","or","provide","your","own",".","Defaults","to","'DistMult","'",".","embedding_dim",":","int","relation","embedding","dimension",".","defaults","to","32","use_feat",":","bool","wether","to","featurize","nodes",",","if","False","will","produce","random","embeddings","and","shape","them","during","training",".","Defaults","to","True","X",":","XSymbolic","Which","columns","in","the","nodes","dataframe","to","featurize",".","Inherets","args","from","graphistry.featurize","(",")",".","Defaults","to","None",".","epochs",":","int","Number","of","training","epochs",".","Defaults","to","2","batch_size",":","int","batch_size",".","Defaults","to","32","train_split",":","Union","[","float",",","int","]","train","percentage",",","between","0",",","1",".","Defaults","to","0.8.","sample_size",":","int","sample","size",".","Defaults","to","1000","num_steps",":","int","num_steps",".","Defaults","to","50","lr",":","float","learning","rate",".","Defaults","to","0.002","inplace",":","Optional","[","bool","]","inplace","device",":","Optional","[","str","]","accelarator",".","Defaults","to","``","cpu","''","evaluate",":","bool","Whether","to","evaluate",".","Defaults","to","False",".","Returns","--","--","--","-","self",":","graphistry","instance"]
code: def embed(
      self,
      relation: str,
      proto: ProtoSymbolic = "DistMult",
      embedding_dim: int = 32,
      use_feat: bool = False,
      X: XSymbolic = None,
      epochs: int = 2,
      batch_size: int = 32,
      train_split: Union[float, int] = 0.8,
      sample_size: int = 1000,
      num_steps: int = 50,
      lr: float = 1e-2,
      inplace: Optional[bool] = False,
      device: Optional["str"] = "cpu",
      evaluate: bool = True,
      *args,
      **kwargs,
  ) -> Plottable:
      """Embed a graph using a relational graph convolutional network (RGCN),
      and return a new graphistry graph with the embeddings as node
      attributes.
  
  
      Parameters
      ----------
      relation : str
          column to use as relation between nodes
      proto : ProtoSymbolic
          metric to use, ['TransE', 'RotateE', 'DistMult'] or provide your own. Defaults to 'DistMult'.
      embedding_dim : int
          relation embedding dimension. defaults to 32
      use_feat : bool
          wether to featurize nodes, if False will produce random embeddings and shape them during training.
          Defaults to True
      X : XSymbolic
          Which columns in the nodes dataframe to featurize. Inherets args from graphistry.featurize().
          Defaults to None.
      epochs : int
          Number of training epochs. Defaults to 2
      batch_size : int
          batch_size. Defaults to 32
      train_split : Union[float, int]
          train percentage, between 0, 1. Defaults to 0.8.
      sample_size : int
          sample size. Defaults to 1000
      num_steps : int
          num_steps. Defaults to 50
      lr : float
          learning rate. Defaults to 0.002
      inplace : Optional[bool]
          inplace
      device : Optional[str]
          accelarator. Defaults to "cpu"
      evaluate : bool
          Whether to evaluate. Defaults to False.
  
      Returns
      -------
          self : graphistry instance
      """
      # this is temporary, will be fixed in future releases
      try:
          if isinstance(self._nodes, cudf.DataFrame):
              self._nodes = self._nodes.to_pandas()
      except:
          pass
      try:
          if isinstance(self._edges, cudf.DataFrame):
              self._edges = self._edges.to_pandas()
      except:
          pass
      if inplace:
          res = self
      else:
          res = self.bind()
  
      requires_new_model = False
      if res._relation != relation:
          requires_new_model = True
          res._relation = relation
      if res._use_feat != use_feat:
          requires_new_model = True
          res._use_feat = use_feat
      if res._kg_embed_dim != embedding_dim:
          requires_new_model = True
          res._kg_embed_dim = embedding_dim
      res._build_new_embedding_model = requires_new_model
      res._train_split = train_split
      res._eval_flag = evaluate
      res._device = device
  
      if callable(proto):
          res._proto = proto
      else:
          res._proto = res._protocol[proto]
  
      if res._use_feat and res._nodes is not None:
          res = res.featurize(kind="nodes", X=X, *args, **kwargs)  # type: ignore
  
      if (
          not hasattr(res, "_triplets")
          or res._build_new_embedding_model
      ):
          res = res._preprocess_embedding_data(res, train_split=train_split)  # type: ignore
          res = res._build_graph(res)  # type: ignore
  
      return res._train_embedding(
          res,
          epochs,
          batch_size,
          lr=lr,
          sample_size=sample_size,
          num_steps=num_steps,
          device=device,
      )
  
imports: import logging
  import numpy
  import pandas
  from typing import Optional, Union, Callable, List, TYPE_CHECKING, Any, Tuple
  from .PlotterBase import Plottable
  from .compute.ComputeMixin import ComputeMixin
label_desc: Use image node_id 7 for calling the HeterographEmbedModuleMixin obj's underlying member method code with example usage: obj.embed(relation, proto, embedding_dim, use_feat, X, epochs, batch_size, train_split, sample_size, num_steps, lr, inplace, device, evaluate) and returns: res