c672738b39c8f739551da0d88991a2fedfba3e14,deeppavlov/models/ranking/metrics.py,,rank_response,#Any#Any#,37

Before Change



@register_metric("rank_response")
def rank_response(y_true, y_pred):
    labels = np.array(y_true)
    predictions = np.array(y_pred)
    predictions = np.argsort(predictions, -1)
    ranks = []
    for i in range(predictions.shape[0]):

After Change


    num_examples = float(len(y_pred))
    predictions = np.array(y_pred)
    predictions = np.flip(np.argsort(predictions, -1), -1)
    rank_tot = 0
    for el in predictions:
        for i, x in enumerate(el):
            if x == 0:
                rank_tot += i
                break
    return float(rank_tot)/num_examples

@register_metric("r@1_insQA")
def r_at_1_insQA(y_true, y_pred):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: deepmipt/DeepPavlov
Commit Name: c672738b39c8f739551da0d88991a2fedfba3e14
Time: 2018-10-04
Author: puleon@mail.ru
File Name: deeppavlov/models/ranking/metrics.py
Class Name:
Method Name: rank_response


Project Name: facebookresearch/Horizon
Commit Name: d26e9010a7b3a283f70a86f5d51730964e900fa4
Time: 2020-05-26
Author: wangkaiwen998@gmail.com
File Name: reagent/gym/runners/gymrunner.py
Class Name:
Method Name: evaluate_for_n_episodes


Project Name: PyMVPA/PyMVPA
Commit Name: eb4950c06f23adcbd73cb635fba86bac56276deb
Time: 2014-02-26
Author: michael.hanke@gmail.com
File Name: mvpa2/tests/test_rsa.py
Class Name:
Method Name: test_DissimilarityConsistencyMeasure


Project Name: geomstats/geomstats
Commit Name: 9d6281d3b2f472e5e130dbf88078c433d0795f46
Time: 2020-04-24
Author: ninamio78@gmail.com
File Name: geomstats/_backend/pytorch/__init__.py
Class Name:
Method Name: all