Skip to content

Commit 2043f77

Browse files
committed
Revert "ORL: Fix tuple error when removed every instance"
This reverts commit 20b06d5.
1 parent d15c3f0 commit 2043f77

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

adlib/learners/outlier_removal_learner.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,7 @@ def train(self):
5050
iteration = 0
5151

5252
while cutoff < max_cutoff:
53-
try:
54-
fvs, labels = self._remove_outliers(fvs, labels, cutoff)
55-
except: # Failure - usually when there are no instances left (removes all)
56-
if self.verbose:
57-
print('\nORL Iteration:', iteration, '- factor:', factor,
58-
'- cutoff:', cutoff, '- FAILURE\n')
59-
60-
factor += 1
61-
cutoff = base_cutoff * factor
62-
fvs, labels = deepcopy(orig_fvs), deepcopy(orig_labels)
63-
iteration += 1
53+
fvs, labels = self._remove_outliers(fvs, labels, cutoff)
6454

6555
self.w = np.full(fvs.shape[1], 0.0)
6656
for i, fv in enumerate(fvs):
@@ -107,7 +97,7 @@ def _remove_outliers(self, fvs, labels, cutoff):
10797
while old_number_of_instances != len(labels):
10898
# Assume at least 50% are non-poisonous instances
10999
if iteration > 0 and old_number_of_instances < 0.5 * original_num_instances:
110-
raise ValueError()
100+
break
111101

112102
if self.verbose:
113103
print('Iteration:', iteration, '- num_instances:', len(labels))

0 commit comments

Comments
 (0)