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

Before Change


    labels = np.array(y_true)
    predictions = np.array(y_pred)
    predictions = np.argsort(predictions, -1)
    ranks = []
    for i in range(predictions.shape[0]):
        for j in range(predictions.shape[1]):
            if predictions[i][j] in np.arange(labels[i][j]):
                ranks.append(j)

After Change


    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: 5

Non-data size: 6

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: rwth-i6/returnn-experiments
Commit Name: a21861f99e3dc4b778fd776b3e8e00dbaee988ca
Time: 2021-03-27
Author: albzey@gmail.com
File Name: common/models/encoder/blstm_cnn_specaug.py
Class Name:
Method Name: make_net


Project Name: Qiskit/qiskit-aqua
Commit Name: cfa2566a4e464b2ad1c22cf179dd8e0045d1dbb0
Time: 2018-10-01
Author: manoel@us.ibm.com
File Name: qiskit_aqua/quantumalgorithm.py
Class Name: QuantumAlgorithm
Method Name: register_and_get_operational_backends


Project Name: onnx/onnx-coreml
Commit Name: 624d14284e35d6ce9c371c39f7e387002ccf4913
Time: 2018-08-25
Author: aseem.elec@gmail.com
File Name: onnx_coreml/_transformers.py
Class Name: ImageScalerRemover
Method Name: __call__


Project Name: tensorflow/agents
Commit Name: 9a3e9d21273da7ae40da9f70cb6df1b077b08105
Time: 2019-12-05
Author: kbanoop@google.com
File Name: tf_agents/networks/actor_distribution_network_test.py
Class Name: ActorDistributionNetworkTest
Method Name: testDropoutFCLayersWithConv