code: def _get_cosine_similarity(
      train_df,
      item_feature_df=None,
      item_sim_measure=DEFAULT_ITEM_SIM_MEASURE,
      col_item_features=DEFAULT_ITEM_FEATURES_COL,
      col_user=DEFAULT_USER_COL,
      col_item=DEFAULT_ITEM_COL,
      col_sim=DEFAULT_SIMILARITY_COL,
  ):
      if item_sim_measure == "item_cooccurrence_count":
          # calculate item-item similarity based on item co-occurrence count
          df_cosine_similarity = _get_cooccurrence_similarity(
              train_df, col_user, col_item, col_sim
          )
      elif item_sim_measure == "item_feature_vector":
          # calculdf_cosine_similarity = ate item-item similarity based on item feature vectors
          df_cosine_similarity = _get_item_feature_similarity(
              item_feature_df, col_item_features, col_user, col_item
          )
      else:
          raise Exception(
              "item_sim_measure not recognized! The available options include 'item_cooccurrence_count' and 'item_feature_vector'."
          )
      return df_cosine_similarity
  
imports: import numpy
  import pandas
  from functools import wraps
  from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score, explained_variance_score, roc_auc_score, log_loss
  from recommenders.utils.constants import DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_RATING_COL, DEFAULT_PREDICTION_COL, DEFAULT_RELEVANCE_COL, DEFAULT_SIMILARITY_COL, DEFAULT_ITEM_FEATURES_COL, DEFAULT_ITEM_SIM_MEASURE, DEFAULT_K, DEFAULT_THRESHOLD
  from recommenders.datasets.pandas_df_utils import has_columns, has_same_base_dtype, lru_cache_df
label_desc: Use image node_id 20 for calling a global function with example usage: _get_cosine_similarity(train_df, item_feature_df, item_sim_measure, col_item_features, col_user, col_item, col_sim) and returns: df_cosine_similarity