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: Fit the model to observations.
  
  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
  -------
  self : object
docstr_tok: ["Fit","the","model","to","observations",".","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","--","--","--","-","self",":","object"]
code: def fit(self, train_set, val_set=None):
      """Fit the model to observations.
  
      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
      -------
      self : object
      """
      if self.is_fitted:
          warnings.warn(
              "Model is already fitted. Re-fitting will overwrite the previous model."
          )
  
      self.reset_info()
      train_set.reset()
      if val_set is not None:
          val_set.reset()
  
      # get some useful information for prediction
      self.num_users = train_set.num_users
      self.num_items = train_set.num_items
      self.uid_map = train_set.uid_map
      self.iid_map = train_set.iid_map
      self.min_rating = train_set.min_rating
      self.max_rating = train_set.max_rating
      self.global_mean = train_set.global_mean
  
      # just for future wrapper to call fit(), not supposed to be used during prediction
      self.train_set = train_set
      self.val_set = val_set
  
      self.is_fitted = True
  
      return self
  
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 12 for calling the Recommender obj's underlying member method code with example usage: obj.fit(train_set, val_set) and returns: self