f4beaac559e00a3676d942dc7e8fea69efc01cfe,catalyst/metrics/hitrate.py,,hitrate,#Any#Any#Any#,8
Before Change
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
for k in topk:
k = min(outputs.size(1), k)
hits_score = torch.sum(targets_sort_by_outputs[:, :k], dim=1) / k
results.append(torch.mean(hits_score) )
return results
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances Project Name: catalyst-team/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/hitrate.py
Class Name:
Method Name: hitrate
Project Name: d2l-ai/d2l-zh
Commit Name: ef784a5b9046b1861de9d7ebba06e2d51a87c0cd
Time: 2018-08-28
Author: muli@cs.cmu.edu
File Name: gluonbook/utils.py
Class Name:
Method Name: get_data_ch7
Project Name: tsurumeso/waifu2x-chainer
Commit Name: 055c61d73514d471158ee36b83762802c8d4e3d4
Time: 2018-07-14
Author: tsurumeso@gmail.com
File Name: lib/loss/clipped_weighted_huber_loss.py
Class Name: ClippedWeightedHuberLoss
Method Name: forward
Project Name: keras-team/autokeras
Commit Name: 8875b3f357843eba1e26c51dd9a6800dc5d8920b
Time: 2017-12-22
Author: jhfjhfj1@gmail.com
File Name: experiments/mnist.py
Class Name:
Method Name: