Skip to content

Commit

Permalink
bug fix: error results when negative_if_not_exists is set
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatYYX committed Apr 8, 2020
1 parent 8ddb3d2 commit 902dfcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions rltk/evaluation/ground_truth.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def is_member(self, id1: str, id2: str) -> bool:
Returns:
bool:
Note:
This method is not impacted by `negative_if_not_exists`.
"""
key = self.encode_ids(id1, id2)
return key in self._ground_truth_data
Expand Down
2 changes: 1 addition & 1 deletion rltk/evaluation/trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def add_result(self, record1: Record, record2: Record, is_positive: bool, confid
is_positive (bool): if the prediction of these two records is pair
confidence (float): the probability of positive
"""
if confidence >= self._min_confidence and self._ground_truth.is_member(record1.id, record2.id):
if confidence >= self._min_confidence and (self._ground_truth.get_label(record1.id, record2.id) is not None):
if self._top_k == 0 or len(self._results) < self._top_k:
cur = self.Result(record1, record2, is_positive, confidence, **kwargs)
heapq.heappush(self._results, cur)
Expand Down

0 comments on commit 902dfcd

Please sign in to comment.