code: def cosine_similarity(vec1, vec2) -> float:
      """
      Cosine similarity between two scipy sparse row matricies.
      """
      numerator = np.dot(vec1, vec2.transpose())[0, 0]
      denominator = np.linalg.norm(vec1.data) * np.linalg.norm(
          vec2.data
      )
      return numerator / max(denominator, 1e-8)
  
file_path: ParlAI/parlai/agents/tfidf_retriever/utils.py
imports: import regex
  import unicodedata
  import numpy
  import scipy.sparse
  from sklearn.utils import murmurhash3_32
label_desc: Use image node_id 7 for calling a global function with example usage: cosine_similarity(vec1, vec2) and returns: unknown