daft.functions.cosine_similarity#
cosine_similarity #
cosine_similarity(left: Expression, right: Expression) -> Expression
Compute the cosine similarity between two embeddings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
left | FixedSizeList or Embedding Expression | The left vector | required |
right | FixedSizeList or Embedding Expression | The right vector | required |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Float64 Expression | the cosine similarity between the two vectors. |
Source code in daft/functions/similarity.py
25 26 27 28 29 30 31 32 33 34 35 | |