class_docstr: DKN model (Deep Knowledge-Aware Network)
  
  :Citation:
  
      H. Wang, F. Zhang, X. Xie and M. Guo, "DKN: Deep Knowledge-Aware Network for News
      Recommendation", in Proceedings of the 2018 World Wide Web Conference on World
      Wide Web, 2018.
class_docstr_tok: ["DKN","model","(","Deep","Knowledge-Aware","Network",")",":","Citation",":","H.","Wang",",","F.","Zhang",",","X.","Xie","and","M.","Guo",",","``","DKN",":","Deep","Knowledge-Aware","Network","for","News","Recommendation","''",",","in","Proceedings","of","the","2018","World","Wide","Web","Conference","on","World","Wide","Web",",","2018","."]
docstr: The main function to create DKN's logic.
  
  Returns:
      object: Prediction score made by the DKN model.
docstr_tok: ["The","main","function","to","create","DKN","'s","logic",".","Returns",":","object",":","Prediction","score","made","by","the","DKN","model","."]
code: def _build_dkn(self):
      """The main function to create DKN's logic.
  
      Returns:
          object: Prediction score made by the DKN model.
      """
      hparams = self.hparams
      # build attention model for clicked news and candidate news
      (
          click_news_embed_batch,
          candidate_news_embed_batch,
      ) = self._build_pair_attention(
          self.iterator.candidate_news_index_batch,
          self.iterator.candidate_news_entity_index_batch,
          self.iterator.click_news_index_batch,
          self.iterator.click_news_entity_index_batch,
          hparams,
      )
  
      nn_input = tf.concat(
          [click_news_embed_batch, candidate_news_embed_batch], axis=1
      )
  
      dnn_channel_part = 2
      last_layer_size = dnn_channel_part * self.num_filters_total
      layer_idx = 0
      hidden_nn_layers = []
      hidden_nn_layers.append(nn_input)
      with tf.compat.v1.variable_scope(
          "nn_part", initializer=self.initializer
      ):
          for idx, layer_size in enumerate(hparams.layer_sizes):
              curr_w_nn_layer = tf.compat.v1.get_variable(
                  name="w_nn_layer" + str(layer_idx),
                  shape=[last_layer_size, layer_size],
                  dtype=tf.float32,
              )
              curr_b_nn_layer = tf.compat.v1.get_variable(
                  name="b_nn_layer" + str(layer_idx),
                  shape=[layer_size],
                  dtype=tf.float32,
              )
              curr_hidden_nn_layer = tf.compat.v1.nn.xw_plus_b(
                  hidden_nn_layers[layer_idx],
                  curr_w_nn_layer,
                  curr_b_nn_layer,
              )
              if hparams.enable_BN is True:
                  curr_hidden_nn_layer = (
                      tf.compat.v1.layers.batch_normalization(
                          curr_hidden_nn_layer,
                          momentum=0.95,
                          epsilon=0.0001,
                          training=self.is_train_stage,
                      )
                  )
  
              activation = hparams.activation[idx]
              curr_hidden_nn_layer = self._active_layer(
                  logit=curr_hidden_nn_layer, activation=activation
              )
              hidden_nn_layers.append(curr_hidden_nn_layer)
              layer_idx += 1
              last_layer_size = layer_size
              self.layer_params.append(curr_w_nn_layer)
              self.layer_params.append(curr_b_nn_layer)
  
          w_nn_output = tf.compat.v1.get_variable(
              name="w_nn_output",
              shape=[last_layer_size, 1],
              dtype=tf.float32,
          )
          b_nn_output = tf.compat.v1.get_variable(
              name="b_nn_output", shape=[1], dtype=tf.float32
          )
          self.layer_params.append(w_nn_output)
          self.layer_params.append(b_nn_output)
          nn_output = tf.compat.v1.nn.xw_plus_b(
              hidden_nn_layers[-1], w_nn_output, b_nn_output
          )
          return nn_output
  
file_path: recommenders/recommenders/models/deeprec/models/dkn.py
imports: import numpy
  import tensorflow
  from recommenders.models.deeprec.models.base_model import BaseModel
label_desc: Use image node_id 6 for calling the DKN obj's underlying member method code with example usage: obj._build_dkn() and returns: nn_output