class_docstr: Generic class for a recommender model. All recommendation models should inherit from this class.
  
  Parameters
  ----------------
  name: str, required
      Name of the recommender model.
  
  trainable: boolean, optional, default: True
      When False, the model is not trainable.
  
  verbose: boolean, optional, default: False
      When True, running logs are displayed.
  
  Attributes
  ----------
  num_users: int
      Number of users in training data.
  
  num_items: int
      Number of items in training data.
  
  total_users: int
      Number of users in training, validation, and test data.
      In other words, this includes unknown/unseen users.
  
  total_items: int
      Number of items in training, validation, and test data.
      In other words, this includes unknown/unseen items.
  
  uid_map: int
      Global mapping of user ID-index.
  
  iid_map: int
      Global mapping of item ID-index.
  
  max_rating: float
      Maximum value among the rating observations.
  
  min_rating: float
      Minimum value among the rating observations.
  
  global_mean: float
      Average value over the rating observations.
class_docstr_tok: ["Generic","class","for","a","recommender","model",".","All","recommendation","models","should","inherit","from","this","class",".","Parameters","--","--","--","--","--","--","--","--","name",":","str",",","required","Name","of","the","recommender","model",".","trainable",":","boolean",",","optional",",","default",":","True","When","False",",","the","model","is","not","trainable",".","verbose",":","boolean",",","optional",",","default",":","False","When","True",",","running","logs","are","displayed",".","Attributes","--","--","--","--","--","num_users",":","int","Number","of","users","in","training","data",".","num_items",":","int","Number","of","items","in","training","data",".","total_users",":","int","Number","of","users","in","training",",","validation",",","and","test","data",".","In","other","words",",","this","includes","unknown\/unseen","users",".","total_items",":","int","Number","of","items","in","training",",","validation",",","and","test","data",".","In","other","words",",","this","includes","unknown\/unseen","items",".","uid_map",":","int","Global","mapping","of","user","ID-index",".","iid_map",":","int","Global","mapping","of","item","ID-index",".","max_rating",":","float","Maximum","value","among","the","rating","observations",".","min_rating",":","float","Minimum","value","among","the","rating","observations",".","global_mean",":","float","Average","value","over","the","rating","observations","."]
docstr: Check if training should be stopped when validation loss has stopped improving.
  
  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).
  
  min_delta: float, optional, default: 0.
      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: int, optional, default: 0
      Number of epochs with no improvement after which training should be stopped.
  
  Returns
  -------
  res : bool
      Return `True` if model training should be stopped (no improvement on validation set),
      otherwise return `False`.
docstr_tok: ["Check","if","training","should","be","stopped","when","validation","loss","has","stopped","improving",".","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",")",".","min_delta",":","float",",","optional",",","default",":","0",".","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",":","int",",","optional",",","default",":","0","Number","of","epochs","with","no","improvement","after","which","training","should","be","stopped",".","Returns","--","--","--","-","res",":","bool","Return","`","True","`","if","model","training","should","be","stopped","(","no","improvement","on","validation","set",")",",","otherwise","return","`","False","`","."]
code: def early_stop(self, train_set, val_set, min_delta=0.0, patience=0):
      """Check if training should be stopped when validation loss has stopped improving.
  
      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).
  
      min_delta: float, optional, default: 0.
          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: int, optional, default: 0
          Number of epochs with no improvement after which training should be stopped.
  
      Returns
      -------
      res : bool
          Return `True` if model training should be stopped (no improvement on validation set),
          otherwise return `False`.
      """
      self.current_epoch += 1
      current_value = self.monitor_value(train_set, val_set)
      if current_value is None:
          return False
  
      if np.greater_equal(current_value - self.best_value, min_delta):
          self.best_value = current_value
          self.best_epoch = self.current_epoch
          self.wait = 0
      else:
          self.wait += 1
          if self.wait >= patience:
              self.stopped_epoch = self.current_epoch
  
      if self.stopped_epoch > 0:
          print("Early stopping:")
          print(
              "- best epoch = {}, stopped epoch = {}".format(
                  self.best_epoch, self.stopped_epoch
              )
          )
          print(
              "- best monitored value = {:.6f} (delta = {:.6f})".format(
                  self.best_value, current_value - self.best_value
              )
          )
          return True
      return False
  
imports: import copy
  import inspect
  import os
  import pickle
  import warnings
  from datetime import datetime
  from glob import glob
  import numpy
  from ..exception import ScoreException
  from ..utils.common import clip
label_desc: Use image node_id 24 for calling the Recommender obj's underlying member method code with example usage: obj.early_stop(train_set, val_set, min_delta, patience) and returns: False, False, True