Skip to content

Commit

Permalink
Raise an exception if the value of percent of unlabeled data in stopp…
Browse files Browse the repository at this point in the history
…ing criterion is not in [0, 1].
  • Loading branch information
tangypnuaa committed May 21, 2019
1 parent d622746 commit e2367f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions alipy/experiment/stopping_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def is_stop(self):
else:
return False
elif self._stopping_criteria == 'percent_of_unlabel':
if self.value > 1 or self.value < 0:
raise ValueError("Value of percent_of_unlabel should in [0, 1].")
if self._percent >= self.value:
return True
else:
Expand Down
1 change: 1 addition & 0 deletions test/test_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ def test_stop4():
stop4.update_information(example_saver_local)
assert stop4._percent == 1/6
assert stop4.is_stop()

0 comments on commit e2367f7

Please sign in to comment.