Skip to content
Snippets Groups Projects
Commit 1f3af1b4 authored by aastorg2's avatar aastorg2
Browse files

make sure negative examples are unique

parent 2b148106
No related branches found
No related tags found
No related merge requests found
......@@ -15,10 +15,11 @@ class DTreeLearner(LearnerBase):
def __init__(self, state_dim: int, perc_dim: int,
timeout: int = 10000) -> None:
super().__init__()
self.debug_neg_conc= set()
self.debug_neg_perc= set()
self._state_dim: int = state_dim
self._perc_dim: int = perc_dim
self.count_neg_dup =0
self._s2f_func = lambda x: x
# Given a base or derived feature name,
......@@ -127,6 +128,14 @@ class DTreeLearner(LearnerBase):
self._append_to_data_file(feature_vec_list, "true")
def add_negative_examples(self, *args) -> None:
for samp in args:
if samp in self.debug_neg_conc:
self.count_neg_dup+=1
print("repeated negative example: "+ str(samp))
#raise ValueError()
self.debug_neg_conc.add(samp)
print(f"number of negative duplicate {self.count_neg_dup}")
feature_vec_list = [self._s2f_func(sample) for sample in args]
print("Negative feature vectors:", feature_vec_list)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment