class_docstr: KGIN is a knowledge-aware recommendation model. It combines knowledge graph and the user-item interaction
  graph to a new graph called collaborative knowledge graph (CKG). This model explores intents behind a user-item
  interaction by using auxiliary item knowledge.
class_docstr_tok: ["KGIN","is","a","knowledge-aware","recommendation","model",".","It","combines","knowledge","graph","and","the","user-item","interaction","graph","to","a","new","graph","called","collaborative","knowledge","graph","(","CKG",")",".","This","model","explores","intents","behind","a","user-item","interaction","by","using","auxiliary","item","knowledge","."]
code: def __init__(self, config, dataset):
      super(KGIN, self).__init__(config, dataset)
  
      # load parameters info
      self.embedding_size = config["embedding_size"]
      self.n_factors = config["n_factors"]
      self.context_hops = config["context_hops"]
      self.node_dropout_rate = config["node_dropout_rate"]
      self.mess_dropout_rate = config["mess_dropout_rate"]
      self.ind = config["ind"]
      self.sim_decay = config["sim_regularity"]
      self.reg_weight = config["reg_weight"]
      self.temperature = config["temperature"]
  
      # load dataset info
      self.inter_matrix = dataset.inter_matrix(form="coo").astype(
          np.float32
      )  # [n_users, n_items]
      # inter_matrix: [n_users, n_entities]; inter_graph: [n_users + n_entities, n_users + n_entities]
      self.interact_mat, _ = self.get_norm_inter_matrix(mode="si")
      self.kg_graph = dataset.kg_graph(
          form="coo", value_field="relation_id"
      )  # [n_entities, n_entities]
      # edge_index: [2, -1]; edge_type: [-1,]
      self.edge_index, self.edge_type = self.get_edges(self.kg_graph)
  
      # define layers and loss
      self.n_nodes = self.n_users + self.n_entities
      self.user_embedding = nn.Embedding(
          self.n_users, self.embedding_size
      )
      self.entity_embedding = nn.Embedding(
          self.n_entities, self.embedding_size
      )
      self.latent_embedding = nn.Embedding(
          self.n_factors, self.embedding_size
      )
      self.gcn = GraphConv(
          embedding_size=self.embedding_size,
          n_hops=self.context_hops,
          n_users=self.n_users,
          n_relations=self.n_relations,
          n_factors=self.n_factors,
          edge_index=self.edge_index,
          edge_type=self.edge_type,
          interact_mat=self.interact_mat,
          ind=self.ind,
          tmp=self.temperature,
          device=self.device,
          node_dropout_rate=self.node_dropout_rate,
          mess_dropout_rate=self.mess_dropout_rate,
      )
      self.mf_loss = BPRLoss()
      self.reg_loss = EmbLoss()
      self.restore_user_e = None
      self.restore_entity_e = None
  
      # parameters initialization
      self.apply(xavier_uniform_initialization)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import scipy.sparse
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_uniform_initialization
  from recbole.model.layers import SparseDropout
  from recbole.model.loss import BPRLoss, EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 1 to create a new KGIN object from inherited base classes: KnowledgeRecommender with example: obj = KGIN(config, dataset)