class_docstr: Base Evaluation Method
  
  Parameters
  ----------
  data: array-like, required
      Raw preference data in the triplet format [(user_id, item_id, rating_value)].
  
  fmt: str, default: 'UIR'
      Format of the input data. Currently, we are supporting:
  
      'UIR': User, Item, Rating
      'UIRT': User, Item, Rating, Timestamp
  
  rating_threshold: float, optional, default: 1.0
      Threshold used to binarize rating values into positive or negative feedback for
      model evaluation using ranking metrics (rating metrics are not affected).
  
  seed: int, optional, default: None
      Random seed for reproducibility.
  
  exclude_unknowns: bool, optional, default: True
      If `True`, unknown users and items will be ignored during model evaluation.
  
  verbose: bool, optional, default: False
      Output running log.
class_docstr_tok: ["Base","Evaluation","Method","Parameters","--","--","--","--","--","data",":","array-like",",","required","Raw","preference","data","in","the","triplet","format","[","(","user_id",",","item_id",",","rating_value",")","]",".","fmt",":","str",",","default",":","'UIR'","Format","of","the","input","data",".","Currently",",","we","are","supporting",":","'UIR","'",":","User",",","Item",",","Rating","'UIRT","'",":","User",",","Item",",","Rating",",","Timestamp","rating_threshold",":","float",",","optional",",","default",":","1.0","Threshold","used","to","binarize","rating","values","into","positive","or","negative","feedback","for","model","evaluation","using","ranking","metrics","(","rating","metrics","are","not","affected",")",".","seed",":","int",",","optional",",","default",":","None","Random","seed","for","reproducibility",".","exclude_unknowns",":","bool",",","optional",",","default",":","True","If","`","True","`",",","unknown","users","and","items","will","be","ignored","during","model","evaluation",".","verbose",":","bool",",","optional",",","default",":","False","Output","running","log","."]
docstr: Evaluate given models according to given metrics. Supposed to be called by Experiment.
  
  Parameters
  ----------
  model: :obj:`cornac.models.Recommender`
      Recommender model to be evaluated.
  
  metrics: :obj:`iterable`
      List of metrics.
  
  user_based: bool, required
      Evaluation strategy for the rating metrics. Whether results
      are averaging based on number of users or number of ratings.
  
  show_validation: bool, optional, default: True
      Whether to show the results on validation set (if exists).
  
  Returns
  -------
  res: :obj:`cornac.experiment.Result`
docstr_tok: ["Evaluate","given","models","according","to","given","metrics",".","Supposed","to","be","called","by","Experiment",".","Parameters","--","--","--","--","--","model",":",":","obj",":","`","cornac.models.Recommender","`","Recommender","model","to","be","evaluated",".","metrics",":",":","obj",":","`","iterable","`","List","of","metrics",".","user_based",":","bool",",","required","Evaluation","strategy","for","the","rating","metrics",".","Whether","results","are","averaging","based","on","number","of","users","or","number","of","ratings",".","show_validation",":","bool",",","optional",",","default",":","True","Whether","to","show","the","results","on","validation","set","(","if","exists",")",".","Returns","--","--","--","-","res",":",":","obj",":","`","cornac.experiment.Result","`"]
code: def evaluate(self, model, metrics, user_based, show_validation=True):
      """Evaluate given models according to given metrics. Supposed to be called by Experiment.
  
      Parameters
      ----------
      model: :obj:`cornac.models.Recommender`
          Recommender model to be evaluated.
  
      metrics: :obj:`iterable`
          List of metrics.
  
      user_based: bool, required
          Evaluation strategy for the rating metrics. Whether results
          are averaging based on number of users or number of ratings.
  
      show_validation: bool, optional, default: True
          Whether to show the results on validation set (if exists).
  
      Returns
      -------
      res: :obj:`cornac.experiment.Result`
      """
      if self.train_set is None:
          raise ValueError("train_set is required but None!")
      if self.test_set is None:
          raise ValueError("test_set is required but None!")
  
      self._reset()
  
      ###########
      # FITTING #
      ###########
      if self.verbose:
          print("\n[{}] Training started!".format(model.name))
  
      start = time.time()
      model.fit(self.train_set, self.val_set)
      train_time = time.time() - start
  
      ##############
      # EVALUATION #
      ##############
      if self.verbose:
          print("\n[{}] Evaluation started!".format(model.name))
  
      rating_metrics, ranking_metrics = self.organize_metrics(metrics)
  
      start = time.time()
      model.transform(self.test_set)
      test_result = self.eval(
          model=model,
          train_set=self.train_set,
          test_set=self.test_set,
          val_set=self.val_set,
          rating_threshold=self.rating_threshold,
          exclude_unknowns=self.exclude_unknowns,
          rating_metrics=rating_metrics,
          ranking_metrics=ranking_metrics,
          user_based=user_based,
          verbose=self.verbose,
      )
      test_time = time.time() - start
      test_result.metric_avg_results["Train (s)"] = train_time
      test_result.metric_avg_results["Test (s)"] = test_time
  
      val_result = None
      if show_validation and self.val_set is not None:
          start = time.time()
          model.transform(self.val_set)
          val_result = self.eval(
              model=model,
              train_set=self.train_set,
              test_set=self.val_set,
              val_set=None,
              rating_threshold=self.rating_threshold,
              exclude_unknowns=self.exclude_unknowns,
              rating_metrics=rating_metrics,
              ranking_metrics=ranking_metrics,
              user_based=user_based,
              verbose=self.verbose,
          )
          val_time = time.time() - start
          val_result.metric_avg_results["Time (s)"] = val_time
  
      return test_result, val_result
  
imports: from collections import OrderedDict
  import time
  import numpy
  from scipy.sparse import csr_matrix
  from tqdm.auto import tqdm
  from ..data import FeatureModality
  from ..data import TextModality, ReviewModality
  from ..data import ImageModality
  from ..data import GraphModality
  from ..data import SentimentModality
  from ..data import Dataset
  from ..metrics import RatingMetric
  from ..metrics import RankingMetric
  from ..experiment.result import Result
  from ..utils import get_rng
label_desc: Use image node_id 31 for calling the BaseMethod obj's underlying member method code with example usage: obj.evaluate(model, metrics, user_based, show_validation) and returns: test_result,  val_result