Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs598mp-fall2021-proj
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
chsieh16
cs598mp-fall2021-proj
Commits
1f3af1b4
Commit
1f3af1b4
authored
3 years ago
by
aastorg2
Browse files
Options
Downloads
Patches
Plain Diff
make sure negative examples are unique
parent
2b148106
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dtree_learner.py
+11
-2
11 additions, 2 deletions
dtree_learner.py
with
11 additions
and
2 deletions
dtree_learner.py
+
11
−
2
View file @
1f3af1b4
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment