Skip to content

Commit

Permalink
'n' should be length of ranked list not length of qrels.
Browse files Browse the repository at this point in the history
  • Loading branch information
bevankoopman committed Dec 22, 2016
1 parent e4b7e24 commit f53acb0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions inst_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def inst_algorithm(T, ranked_gains, n, defaultValue):

if i > n:
r_i = defaultValue
elif i > len(ranked_gains):
r_i = defaultValue
elif ranked_gains[i-1] == -1: # use -1.0 to indicate undefined values for items in the ranking
r_i = defaultValue
else:
Expand Down Expand Up @@ -184,8 +182,8 @@ def inst_eval(results, qrels, Ts, max_graded_label, complete_qrel_queries):
ranked_gains = calc_ranked_gains(results[qId], qrels[qId], max_graded_label)

# get the scores - assume score is 0.0000 if there are no results
score_min = inst_algorithm(T, ranked_gains, len(qrels[qId]), 0.0) if len(ranked_gains) > 0 else 0.000 # assume unjudged are all not relevant
score_max = inst_algorithm(T, ranked_gains, len(qrels[qId]), 1.0) if len(ranked_gains) > 0 else 0.000 # assume unjudged are all relevant
score_min = inst_algorithm(T, ranked_gains, len(results[qId]), 0.0) if len(ranked_gains) > 0 else 0.000 # assume unjudged are all not relevant
score_max = inst_algorithm(T, ranked_gains, len(results[qId]), 1.0) if len(ranked_gains) > 0 else 0.000 # assume unjudged are all relevant


residual = score_max - score_min
Expand Down

0 comments on commit f53acb0

Please sign in to comment.