Skip to content

Commit

Permalink
error handling when input sample is not found in the dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
tungen committed Dec 31, 2015
1 parent b99dcf2 commit a798c97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libact/labelers/ideal_labeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ def __init__(self, dataset, **kwargs):
self.y = y

def label(self, feature):
if np.count_nonzero([np.array_equal(x, feature) for x in self.X])==0
raise ValueError("No matching sample found in the dataset.")
return self.y[np.where([np.array_equal(x, feature) for x in self.X])[0]]

0 comments on commit a798c97

Please sign in to comment.