class_docstr: KGAT is a knowledge-based recommendation model. It combines knowledge graph and the user-item interaction
  graph to a new graph called collaborative knowledge graph (CKG). This model learns the representations of users and
  items by exploiting the structure of CKG. It adopts a GNN-based architecture and define the attention on the CKG.
class_docstr_tok: ["KGAT","is","a","knowledge-based","recommendation","model",".","It","combines","knowledge","graph","and","the","user-item","interaction","graph","to","a","new","graph","called","collaborative","knowledge","graph","(","CKG",")",".","This","model","learns","the","representations","of","users","and","items","by","exploiting","the","structure","of","CKG",".","It","adopts","a","GNN-based","architecture","and","define","the","attention","on","the","CKG","."]
code: def __init__(self, config, dataset):
      super(KGAT, self).__init__(config, dataset)
  
      # load dataset info
      self.ckg = dataset.ckg_graph(
          form="dgl", value_field="relation_id"
      )
      self.all_hs = torch.LongTensor(
          dataset.ckg_graph(form="coo", value_field="relation_id").row
      ).to(self.device)
      self.all_ts = torch.LongTensor(
          dataset.ckg_graph(form="coo", value_field="relation_id").col
      ).to(self.device)
      self.all_rs = torch.LongTensor(
          dataset.ckg_graph(form="coo", value_field="relation_id").data
      ).to(self.device)
      self.matrix_size = torch.Size(
          [
              self.n_users + self.n_entities,
              self.n_users + self.n_entities,
          ]
      )
  
      # load parameters info
      self.embedding_size = config["embedding_size"]
      self.kg_embedding_size = config["kg_embedding_size"]
      self.layers = [self.embedding_size] + config["layers"]
      self.aggregator_type = config["aggregator_type"]
      self.mess_dropout = config["mess_dropout"]
      self.reg_weight = config["reg_weight"]
  
      # generate intermediate data
      self.A_in = (
          self.init_graph()
      )  # init the attention matrix by the structure of ckg
  
      # define layers and loss
      self.user_embedding = nn.Embedding(
          self.n_users, self.embedding_size
      )
      self.entity_embedding = nn.Embedding(
          self.n_entities, self.embedding_size
      )
      self.relation_embedding = nn.Embedding(
          self.n_relations, self.kg_embedding_size
      )
      self.trans_w = nn.Embedding(
          self.n_relations, self.embedding_size * self.kg_embedding_size
      )
      self.aggregator_layers = nn.ModuleList()
      for idx, (input_dim, output_dim) in enumerate(
          zip(self.layers[:-1], self.layers[1:])
      ):
          self.aggregator_layers.append(
              Aggregator(
                  input_dim,
                  output_dim,
                  self.mess_dropout,
                  self.aggregator_type,
              )
          )
      self.tanh = nn.Tanh()
      self.mf_loss = BPRLoss()
      self.reg_loss = EmbLoss()
      self.restore_user_e = None
      self.restore_entity_e = None
  
      # parameters initialization
      self.apply(xavier_normal_initialization)
      self.other_parameter_name = ["restore_user_e", "restore_entity_e"]
  
imports: import numpy
  import scipy.sparse
  import torch
  import torch.nn
  import torch.nn.functional
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.loss import BPRLoss, EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 1 to create a new KGAT object from inherited base classes: KnowledgeRecommender with example: obj = KGAT(config, dataset)