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

Before Change


        result (torch.Tensor):
            The mrr score for each user.
    
    k = min(outputs.size(1), k)
    _, indices_for_sort = outputs.sort(descending=True, dim=-1)
    true_sorted_by_preds = torch.gather(
        targets, dim=-1, index=indices_for_sort
    )

After Change


        mrr_score (torch.Tensor):
            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: 7

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: nilmtk/nilmtk
Commit Name: 626173412d4281b693244e0705a787c4e7c08031
Time: 2014-07-09
Author: jack-list@xlk.org.uk
File Name: nilmtk/metrics.py
Class Name:
Method Name: fraction_energy_assigned_correctly


Project Name: scikit-optimize/scikit-optimize
Commit Name: a225606e6bb4d402b6000e90b91e7acd8e068f88
Time: 2018-05-29
Author: stefano.cereda@moviri.com
File Name: skopt/plots.py
Class Name:
Method Name: plot_regret