Regression metrics
CosineSimilarity
Bases: MeanMetricWrapper
Computes the cosine similarity between the labels and predictions.
Formula:
The formula is similar to the classic cosine similarity used in deep learning, but scaled to [0.0, 1.0] and adjusted to have a reward that tend towards 1.0 if the two objects are similar (and 0.0 otherwise).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embedding_model
|
EmbeddingModel
|
The embedding model to use to compute the cosine similarity. |
None
|
axis
|
int
|
(Optional) Defaults to |
-1
|
name
|
str
|
(Optional) string name of the metric instance. |
'cosine_similarity'
|
in_mask
|
list
|
(Optional) list of keys to keep to compute the metric. |
None
|
out_mask
|
list
|
(Optional) list of keys to remove to compute the metric. |
None
|