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
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):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
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: NervanaSystems/coach
Commit Name: 39a28aba95b0d8eeb56f7a17b7dad140e601b591
Time: 2018-02-21
Author: zach.dwiel@intel.com
File Name: agents/value_optimization_agent.py
Class Name: ValueOptimizationAgent
Method Name: tf_input_state
Project Name: GPflow/GPflow
Commit Name: 49a385eae93032125a6718433b3ca1753aee3b1e
Time: 2017-11-02
Author: art.art.v@gmail.com
File Name: testing/test_method_equivalence.py
Class Name: TestEquivalence
Method Name: test_all