code: def predict(
      model,
      data,
      usercol=DEFAULT_USER_COL,
      itemcol=DEFAULT_ITEM_COL,
      predcol=DEFAULT_PREDICTION_COL,
  ):
      """Computes predictions of a recommender model from Cornac on the data.
      Can be used for computing rating metrics like RMSE.
  
      Args:
          model (cornac.models.Recommender): A recommender model from Cornac
          data (pandas.DataFrame): The data on which to predict
          usercol (str): Name of the user column
          itemcol (str): Name of the item column
  
      Returns:
          pandas.DataFrame: Dataframe with usercol, itemcol, predcol
      """
      uid_map = model.train_set.uid_map
      iid_map = model.train_set.iid_map
      predictions = [
          [
              getattr(row, usercol),
              getattr(row, itemcol),
              model.rate(
                  user_idx=uid_map.get(
                      getattr(row, usercol), len(uid_map)
                  ),
                  item_idx=iid_map.get(
                      getattr(row, itemcol), len(iid_map)
                  ),
              ),
          ]
          for row in data.itertuples()
      ]
      predictions = pd.DataFrame(
          data=predictions, columns=[usercol, itemcol, predcol]
      )
      return predictions
  
imports: import pandas
  import numpy
  from recommenders.utils.constants import DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_PREDICTION_COL
label_desc: Use image node_id 1 for calling a global function with example usage: predict(model, data, usercol, itemcol, predcol) and returns: predictions