code: def score(
      learner,
      test_df,
      user_col=cc.DEFAULT_USER_COL,
      item_col=cc.DEFAULT_ITEM_COL,
      prediction_col=cc.DEFAULT_PREDICTION_COL,
      top_k=None,
  ):
      """Score all users+items provided and reduce to top_k items per user if top_k>0
  
      Args:
          learner (object): Model.
          test_df (pandas.DataFrame): Test dataframe.
          user_col (str): User column name.
          item_col (str): Item column name.
          prediction_col (str): Prediction column name.
          top_k (int): Number of top items to recommend.
  
      Returns:
          pandas.DataFrame: Result of recommendation
      """
      # replace values not known to the model with NaN
      (
          total_users,
          total_items,
      ) = learner.data.train_ds.x.classes.values()
      test_df.loc[
          ~test_df[user_col].isin(total_users), user_col
      ] = np.nan
      test_df.loc[
          ~test_df[item_col].isin(total_items), item_col
      ] = np.nan
  
      # map ids to embedding ids
      u = learner.get_idx(test_df[user_col], is_item=False)
      m = learner.get_idx(test_df[item_col], is_item=True)
  
      # score the pytorch model
      pred = learner.model.forward(u, m)
      scores = pd.DataFrame(
          {
              user_col: test_df[user_col],
              item_col: test_df[item_col],
              prediction_col: pred,
          }
      )
      scores = scores.sort_values(
          [user_col, prediction_col], ascending=[True, False]
      )
      if top_k is not None:
          top_scores = (
              scores.groupby(user_col)
              .head(top_k)
              .reset_index(drop=True)
          )
      else:
          top_scores = scores
      return top_scores
  
file_path: recommenders/recommenders/models/fastai/fastai_utils.py
imports: import numpy
  import pandas
  import fastai
  import fastprogress
  from fastprogress.fastprogress import force_console_behavior
  from recommenders.utils import constants
label_desc: Use image node_id 2 for calling a global function with example usage: score(learner, test_df, user_col, item_col, prediction_col, top_k) and returns: top_scores