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: Fit model with training data
  
  Args:
      data (NCFDataset): initilized Dataset in ./dataset.py
docstr_tok: ["Fit","model","with","training","data","Args",":","data","(","NCFDataset",")",":","initilized","Dataset","in",".\/dataset.py"]
code: def fit(self, data):
      """Fit model with training data
  
      Args:
          data (NCFDataset): initilized Dataset in ./dataset.py
      """
  
      # get user and item mapping dict
      self.user2id = data.user2id
      self.item2id = data.item2id
      self.id2user = data.id2user
      self.id2item = data.id2item
  
      # loop for n_epochs
      for epoch_count in range(1, self.n_epochs + 1):
          # negative sampling for training
          train_begin = time()
  
          # initialize
          train_loss = []
  
          # calculate loss and update NCF parameters
          for user_input, item_input, labels in data.train_loader(
              self.batch_size
          ):
              user_input = np.array(
                  [self.user2id[x] for x in user_input]
              )
              item_input = np.array(
                  [self.item2id[x] for x in item_input]
              )
              labels = np.array(labels)
  
              feed_dict = {
                  self.user_input: user_input[..., None],
                  self.item_input: item_input[..., None],
                  self.labels: labels[..., None],
              }
  
              # get loss and execute optimization
              loss, _ = self.sess.run(
                  [self.loss, self.optimizer], feed_dict
              )
              train_loss.append(loss)
          train_time = time() - train_begin
  
          # output every self.verbose
          if self.verbose and epoch_count % self.verbose == 0:
              logger.info(
                  "Epoch %d [%.2fs]: train_loss = %.6f "
                  % (
                      epoch_count,
                      train_time,
                      sum(train_loss) / len(train_loss),
                  )
              )
  
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 6 for calling the NCF obj's underlying member method code with example usage: obj.fit(data) without return types