cosine_similarity#

langchain_chroma.vectorstores.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.

Raises:

ValueError – If the number of columns in X and Y are not the same.

Parameters:
  • X (List[List[float]] | List[ndarray] | ndarray)

  • Y (List[List[float]] | List[ndarray] | ndarray)

Return type:

ndarray

Examples using cosine_similarity