We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b99dcf2 commit 22a043dCopy full SHA for 22a043d
1 file changed
libact/labelers/ideal_labeler.py
@@ -26,4 +26,6 @@ def __init__(self, dataset, **kwargs):
26
self.y = y
27
28
def label(self, feature):
29
- return self.y[np.where([np.array_equal(x, feature) for x in self.X])[0]]
+ if np.count_nonzero([np.array_equal(x, feature) for x in self.X])==0
30
+ raise ValueError("No matching sample found in the dataset.")
31
+ return self.y[np.where([np.array_equal(x, feature) for x in self.X])]
0 commit comments