Abstract base class for computing retrieval metrics.
Inherits From: ABC
TFSimilarity.indexer.RetrievalMetric(
name: str = ,
canonical_name: str = ,
k: int = 5,
distance_threshold: float = math.inf,
average: str = micro
) -> None
name | Name associated with the metric object, e.g., recall@5 |
canonical_name | The canonical name associated with metric, e.g., recall@K |
k | The number of nearest neighbors over which the metric is computed. |
distance_threshold | The max distance below which a nearest neighbor is considered a valid match. |
average |
'micro' Determines the type of averaging performed over the
queries.
|
RetrievalMetric measure the retrieval quality given a query label and the labels from the set of lookup results.
name |
compute(
*,
query_labels: <a href="../../TFSimilarity/callbacks/IntTensor.md">TFSimilarity.callbacks.IntTensor```
</a>,
lookup_labels: <a href="../../TFSimilarity/callbacks/IntTensor.md">TFSimilarity.callbacks.IntTensor```
</a>,
lookup_distances: <a href="../../TFSimilarity/callbacks/FloatTensor.md">TFSimilarity.callbacks.FloatTensor```
</a>,
match_mask: <a href="../../TFSimilarity/utils/BoolTensor.md">TFSimilarity.utils.BoolTensor```
</a>
) -> <a href="../../TFSimilarity/callbacks/FloatTensor.md">TFSimilarity.callbacks.FloatTensor```
</a>
Compute the retrieval metric.
Args | |
---|---|
query_labels | A 1D array of the labels associated with the queries. |
lookup_labels | A 2D array where the jth row is the labels associated with the set of k neighbors for the jth query. |
lookup_distances | A 2D array where the jth row is the distances between the jth query and the set of k neighbors. |
match_mask | A 2D mask where a 1 indicates a match between the jth query and the kth neighbor and a 0 indicates a mismatch. |
Returns | |
---|---|
A rank 0 tensor containing the metric. |
get_config()