class_docstr: Neural Collaborative Filtering (NCF) implementation
  
  :Citation:
  
      He, Xiangnan, Lizi Liao, Hanwang Zhang, Liqiang Nie, Xia Hu, and Tat-Seng Chua. "Neural collaborative filtering."
      In Proceedings of the 26th International Conference on World Wide Web, pp. 173-182. International World Wide Web
      Conferences Steering Committee, 2017. Link: https://www.comp.nus.edu.sg/~xiangnan/papers/ncf.pdf
class_docstr_tok: ["Neural","Collaborative","Filtering","(","NCF",")","implementation",":","Citation",":","He",",","Xiangnan",",","Lizi","Liao",",","Hanwang","Zhang",",","Liqiang","Nie",",","Xia","Hu",",","and","Tat-Seng","Chua",".","``","Neural","collaborative","filtering",".","''","In","Proceedings","of","the","26th","International","Conference","on","World","Wide","Web",",","pp",".","173-182.","International","World","Wide","Web","Conferences","Steering","Committee",",","2017",".","Link",":","https",":","\/\/www.comp.nus.edu.sg\/~xiangnan\/papers\/ncf.pdf"]
docstr: Load gmf and mlp model parameters for further use in NeuMF.
  NeuMF model --> load parameters in `gmf_dir` and `mlp_dir`
docstr_tok: ["Load","gmf","and","mlp","model","parameters","for","further","use","in","NeuMF",".","NeuMF","model","--",">","load","parameters","in","`","gmf_dir","`","and","`","mlp_dir","`"]
code: def _load_neumf(self, gmf_dir, mlp_dir, alpha):
      """Load gmf and mlp model parameters for further use in NeuMF.
      NeuMF model --> load parameters in `gmf_dir` and `mlp_dir`
      """
      # load gmf part
      variables = tf.compat.v1.global_variables()
      # get variables with 'gmf'
      var_flow_restore = [
          val
          for val in variables
          if "gmf" in val.name and "ncf" not in val.name
      ]
      # load 'gmf' variable
      saver = tf.compat.v1.train.Saver(var_flow_restore)
      # restore
      saver.restore(self.sess, os.path.join(gmf_dir, MODEL_CHECKPOINT))
  
      # load mlp part
      variables = tf.compat.v1.global_variables()
      # get variables with 'gmf'
      var_flow_restore = [
          val
          for val in variables
          if "mlp" in val.name and "ncf" not in val.name
      ]
      # load 'gmf' variable
      saver = tf.compat.v1.train.Saver(var_flow_restore)
      # restore
      saver.restore(self.sess, os.path.join(mlp_dir, MODEL_CHECKPOINT))
  
      # concat pretrain h_from_gmf and h_from_mlp
      vars_list = tf.compat.v1.get_collection(
          tf.compat.v1.GraphKeys.GLOBAL_VARIABLES, scope="ncf"
      )
  
      assert len(vars_list) == 1
      ncf_fc = vars_list[0]
  
      # get weight from gmf and mlp
      gmf_fc = tf.train.load_variable(gmf_dir, ncf_fc.name)
      mlp_fc = tf.train.load_variable(mlp_dir, ncf_fc.name)
  
      # load fc layer by tf.concat
      assign_op = tf.compat.v1.assign(
          ncf_fc,
          tf.concat([alpha * gmf_fc, (1 - alpha) * mlp_fc], axis=0),
      )
      self.sess.run(assign_op)
  
file_path: recommenders/recommenders/models/ncf/ncf_singlenode.py
imports: import os
  import numpy
  import tensorflow
  import tf_slim
  from time import time
  import logging
label_desc: Use image node_id 5 for calling the NCF obj's underlying member method code with example usage: obj._load_neumf(gmf_dir, mlp_dir, alpha) without return types