class_docstr: Spark Evaluator for diversity, coverage, novelty, serendipity
class_docstr_tok: ["Spark","Evaluator","for","diversity",",","coverage",",","novelty",",","serendipity"]
code: def _get_cosine_similarity(self, n_partitions=200):
      if self.item_sim_measure == "item_cooccurrence_count":
          # calculate item-item similarity based on item co-occurrence count
          self._get_cooccurrence_similarity(n_partitions)
      elif self.item_sim_measure == "item_feature_vector":
          # calculate item-item similarity based on item feature vectors
          self._get_item_feature_similarity(n_partitions)
      else:
          raise Exception(
              "item_sim_measure not recognized! The available options include 'item_cooccurrence_count' and 'item_feature_vector'."
          )
      return self.df_cosine_similarity
  
imports: import numpy
  from recommenders.utils.constants import DEFAULT_PREDICTION_COL, DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_RATING_COL, DEFAULT_RELEVANCE_COL, DEFAULT_SIMILARITY_COL, DEFAULT_ITEM_FEATURES_COL, DEFAULT_ITEM_SIM_MEASURE, DEFAULT_TIMESTAMP_COL, DEFAULT_K, DEFAULT_THRESHOLD
label_desc: Use image node_id 3 for calling the SparkDiversityEvaluation obj's underlying member method code with example usage: obj._get_cosine_similarity(n_partitions) and returns: self