-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
Bug description
When the model predicts a constant value, the topk metrics scores perfect.
When the model predicts the same value for all items, the sort order doesn't change
https://github.com/NVIDIA-Merlin/models/blob/main/tests/unit/tf/metrics/test_metrics_topk.py#L53
The negative sampler creates the batches by putting the positive item on the first position and the negatives on the next ones:
| predictions = tf.concat([positive_scores, negative_scores], axis=-1) |
In that way, we get perfect scores by predicting a constant.
Steps/Code to reproduce bug
Based on the unttest
labels = tf.convert_to_tensor([[0, 1, 0, 1, 0], [1, 0, 0, 1, 0], [0, 0, 0, 0, 1]], tf.float32)
predictions = tf.convert_to_tensor(
[[10, 10, 10, 10, 10], [5, 5, 5, 5, 5], [6, 6, 6, 6, 6]], tf.float32
)
label_relevant_counts = tf.convert_to_tensor([2, 2, 1], tf.float32)
print(labels)
predictions, labels, label_relevant_counts = extract_topk(5, predictions, labels)
print(labels)
Reactions are currently unavailable