Skip to content

Commit

Permalink
fix bug: zero division
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatYYX committed Aug 20, 2018
1 parent 36de463 commit 5bef246
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rltk/evaluation/ground_truth.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def generate_stratified_negatives(self, dataset1: 'Dataset', dataset2: 'Dataset'
for idx, s in enumerate(strata):
stratum_id = str(idx)
# nothing to pick
if s['p'] == 0 or s['n'] == 0:
if len(s['p']) == 0 or len(s['n']) == 0:
strata_weights[stratum_id] = 0.0
continue
strata_weights[stratum_id] = float(len(s['p'])) / len(s['n'])
Expand Down

0 comments on commit 5bef246

Please sign in to comment.