cosine_similarity#

langchain_astradb.utils.mmr.cosine_similarity(x: List[List[float]] | List[ndarray] | ndarray, y: List[List[float]] | List[ndarray] | ndarray) ndarray[source]#

Row-wise cosine similarity between two equal-width matrices.

Parameters:
  • x (List[List[float]] | List[ndarray] | ndarray) –

  • y (List[List[float]] | List[ndarray] | ndarray) –

Return type:

ndarray

Examples using cosine_similarity