class_docstr: Base class of NCF family.
  
  Parameters
  ----------
  num_epochs: int, optional, default: 20
      Number of epochs.
  
  batch_size: int, optional, default: 256
      Batch size.
  
  num_neg: int, optional, default: 4
      Number of negative instances to pair with a positive instance.
  
  lr: float, optional, default: 0.001
      Learning rate.
  
  learner: str, optional, default: 'adam'
      Specify an optimizer: adagrad, adam, rmsprop, sgd
  
  backend: str, optional, default: 'tensorflow'
      Backend used for model training: tensorflow, pytorch
  
  early_stopping: {min_delta: float, patience: int}, optional, default: None
      If `None`, no early stopping. Meaning of the arguments: 
      
       - `min_delta`: the minimum increase in monitored value on validation set to be considered as improvement,            i.e. an increment of less than min_delta will count as no improvement.
       - `patience`: number of epochs with no improvement after which training should be stopped.
  
  name: string, optional, default: 'NCF'
      Name of the recommender model.
  
  trainable: boolean, optional, default: True
      When False, the model is not trained and Cornac assumes that the model is already         pre-trained.
  
  verbose: boolean, optional, default: False
      When True, some running logs are displayed.
  
  References
  ----------
  * He, X., Liao, L., Zhang, H., Nie, L., Hu, X., & Chua, T. S. (2017, April). Neural collaborative filtering.     In Proceedings of the 26th international conference on world wide web (pp. 173-182).
class_docstr_tok: ["Base","class","of","NCF","family",".","Parameters","--","--","--","--","--","num_epochs",":","int",",","optional",",","default",":","20","Number","of","epochs",".","batch_size",":","int",",","optional",",","default",":","256","Batch","size",".","num_neg",":","int",",","optional",",","default",":","4","Number","of","negative","instances","to","pair","with","a","positive","instance",".","lr",":","float",",","optional",",","default",":","0.001","Learning","rate",".","learner",":","str",",","optional",",","default",":","'adam'","Specify","an","optimizer",":","adagrad",",","adam",",","rmsprop",",","sgd","backend",":","str",",","optional",",","default",":","'tensorflow'","Backend","used","for","model","training",":","tensorflow",",","pytorch","early_stopping",":","{","min_delta",":","float",",","patience",":","int","}",",","optional",",","default",":","None","If","`","None","`",",","no","early","stopping",".","Meaning","of","the","arguments",":","-","`","min_delta","`",":","the","minimum","increase","in","monitored","value","on","validation","set","to","be","considered","as","improvement",",","i.e",".","an","increment","of","less","than","min_delta","will","count","as","no","improvement",".","-","`","patience","`",":","number","of","epochs","with","no","improvement","after","which","training","should","be","stopped",".","name",":","string",",","optional",",","default",":","'NCF'","Name","of","the","recommender","model",".","trainable",":","boolean",",","optional",",","default",":","True","When","False",",","the","model","is","not","trained","and","Cornac","assumes","that","the","model","is","already","pre-trained",".","verbose",":","boolean",",","optional",",","default",":","False","When","True",",","some","running","logs","are","displayed",".","References","--","--","--","--","--","*","He",",","X.",",","Liao",",","L.",",","Zhang",",","H.",",","Nie",",","L.",",","Hu",",","X.",",","&","Chua",",","T.","S.","(","2017",",","April",")",".","Neural","collaborative","filtering",".","In","Proceedings","of","the","26th","international","conference","on","world","wide","web","(","pp",".","173-182",")","."]
docstr: Calculating monitored value used for early stopping on validation set (`val_set`).
  This function will be called by `early_stop()` function.
  
  Parameters
  ----------
  train_set: :obj:`cornac.data.Dataset`, required
      User-Item preference data as well as additional modalities.
  
  val_set: :obj:`cornac.data.Dataset`, optional, default: None
      User-Item preference data for model selection purposes (e.g., early stopping).
  
  Returns
  -------
  res : float
      Monitored value on validation set.
      Return `None` if `val_set` is `None`.
docstr_tok: ["Calculating","monitored","value","used","for","early","stopping","on","validation","set","(","`","val_set","`",")",".","This","function","will","be","called","by","`","early_stop","(",")","`","function",".","Parameters","--","--","--","--","--","train_set",":",":","obj",":","`","cornac.data.Dataset","`",",","required","User-Item","preference","data","as","well","as","additional","modalities",".","val_set",":",":","obj",":","`","cornac.data.Dataset","`",",","optional",",","default",":","None","User-Item","preference","data","for","model","selection","purposes","(","e.g.",",","early","stopping",")",".","Returns","--","--","--","-","res",":","float","Monitored","value","on","validation","set",".","Return","`","None","`","if","`","val_set","`","is","`","None","`","."]
code: def monitor_value(self, train_set, val_set):
      """Calculating monitored value used for early stopping on validation set (`val_set`).
      This function will be called by `early_stop()` function.
  
      Parameters
      ----------
      train_set: :obj:`cornac.data.Dataset`, required
          User-Item preference data as well as additional modalities.
  
      val_set: :obj:`cornac.data.Dataset`, optional, default: None
          User-Item preference data for model selection purposes (e.g., early stopping).
  
      Returns
      -------
      res : float
          Monitored value on validation set.
          Return `None` if `val_set` is `None`.
      """
      if val_set is None:
          return None
  
      from ...metrics import NDCG
      from ...eval_methods import ranking_eval
  
      ndcg_100 = ranking_eval(
          model=self,
          metrics=[NDCG(k=100)],
          train_set=train_set,
          test_set=val_set,
      )[0][0]
  
      return ndcg_100
  
imports: import numpy
  from tqdm.auto import trange
  from ..recommender import Recommender
  from ...utils import get_rng
  from ...exception import ScoreException
label_desc: Use image node_id 13 for calling the NCFBase obj's underlying member method code with example usage: obj.monitor_value(train_set, val_set) and returns: ndcg_100, None