f4beaac559e00a3676d942dc7e8fea69efc01cfe,catalyst/metrics/mrr.py,,mrr,#,8

Before Change



    values, indices = torch.max(true_sorted_by_pred_shrink, dim=1)
    indices = indices.type_as(values).unsqueeze(dim=0).t()
    result = torch.tensor(1.0) / (indices + torch.tensor(1.0))

    zero_sum_mask = values == 0.0
    result[zero_sum_mask] = 0.0

After Change


            The mrr score for each batch.
    
    results = []
    for k in topk:
        results.append(torch.mean(reciprocal_rank(outputs, targets, k)))

    return results


__all__ = ["reciprocal_rank", "mrr"]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: Scitator/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/mrr.py
Class Name:
Method Name: mrr


Project Name: rusty1s/pytorch_geometric
Commit Name: b2002a8ef80ecbecee09fd61b910c987648455c7
Time: 2020-08-26
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/datasets/karate.py
Class Name: KarateClub
Method Name: __init__


Project Name: mariogeiger/se3cnn
Commit Name: f66d3c5ed7b7fa96424fd0d8214594042d9ba3ff
Time: 2019-07-09
Author: geiger.mario@gmail.com
File Name: se3cnn/SO3.py
Class Name:
Method Name: irr_repr