class_docstr: NAML model(Neural News Recommendation with Attentive Multi-View Learning)
  
  Chuhan Wu, Fangzhao Wu, Mingxiao An, Jianqiang Huang, Yongfeng Huang and Xing Xie,
  Neural News Recommendation with Attentive Multi-View Learning, IJCAI 2019
  
  Attributes:
      word2vec_embedding (numpy.ndarray): Pretrained word embedding matrix.
      hparam (object): Global hyper-parameters.
class_docstr_tok: ["NAML","model","(","Neural","News","Recommendation","with","Attentive","Multi-View","Learning",")","Chuhan","Wu",",","Fangzhao","Wu",",","Mingxiao","An",",","Jianqiang","Huang",",","Yongfeng","Huang","and","Xing","Xie",",","Neural","News","Recommendation","with","Attentive","Multi-View","Learning",",","IJCAI","2019","Attributes",":","word2vec_embedding","(","numpy.ndarray",")",":","Pretrained","word","embedding","matrix",".","hparam","(","object",")",":","Global","hyper-parameters","."]
docstr: The main function to create news encoder of NAML.
  news encoder in composed of title encoder, body encoder, vert encoder and subvert encoder
  
  Args:
      embedding_layer (object): a word embedding layer.
  
  Return:
      object: the news encoder of NAML.
docstr_tok: ["The","main","function","to","create","news","encoder","of","NAML",".","news","encoder","in","composed","of","title","encoder",",","body","encoder",",","vert","encoder","and","subvert","encoder","Args",":","embedding_layer","(","object",")",":","a","word","embedding","layer",".","Return",":","object",":","the","news","encoder","of","NAML","."]
code: def _build_newsencoder(self, embedding_layer):
      """The main function to create news encoder of NAML.
      news encoder in composed of title encoder, body encoder, vert encoder and subvert encoder
  
      Args:
          embedding_layer (object): a word embedding layer.
  
      Return:
          object: the news encoder of NAML.
      """
      hparams = self.hparams
      input_title_body_verts = keras.Input(
          shape=(hparams.title_size + hparams.body_size + 2,),
          dtype="int32",
      )
  
      sequences_input_title = layers.Lambda(
          lambda x: x[:, : hparams.title_size]
      )(input_title_body_verts)
      sequences_input_body = layers.Lambda(
          lambda x: x[
              :,
              hparams.title_size : hparams.title_size
              + hparams.body_size,
          ]
      )(input_title_body_verts)
      input_vert = layers.Lambda(
          lambda x: x[
              :,
              hparams.title_size
              + hparams.body_size : hparams.title_size
              + hparams.body_size
              + 1,
          ]
      )(input_title_body_verts)
      input_subvert = layers.Lambda(
          lambda x: x[:, hparams.title_size + hparams.body_size + 1 :]
      )(input_title_body_verts)
  
      title_repr = self._build_titleencoder(embedding_layer)(
          sequences_input_title
      )
      body_repr = self._build_bodyencoder(embedding_layer)(
          sequences_input_body
      )
      vert_repr = self._build_vertencoder()(input_vert)
      subvert_repr = self._build_subvertencoder()(input_subvert)
  
      concate_repr = layers.Concatenate(axis=-2)(
          [title_repr, body_repr, vert_repr, subvert_repr]
      )
      news_repr = AttLayer2(
          hparams.attention_hidden_dim, seed=self.seed
      )(concate_repr)
  
      model = keras.Model(
          input_title_body_verts, news_repr, name="news_encoder"
      )
      return model
  
file_path: recommenders/recommenders/models/newsrec/models/naml.py
imports: import numpy
  import tensorflow.keras
  from tensorflow.keras import layers
  from recommenders.models.newsrec.models.base_model import BaseModel
  from recommenders.models.newsrec.models.layers import AttLayer2
label_desc: Use image node_id 7 for calling the NAMLModel obj's underlying member method code with example usage: obj._build_newsencoder(embedding_layer) and returns: model