Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ppg-moderation-classifier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
oschmanf
ppg-moderation-classifier
Commits
9fcfed88
Commit
9fcfed88
authored
1 year ago
by
Franziska Oschmann
Browse files
Options
Downloads
Patches
Plain Diff
Only return most common topics
parent
c70cbc71
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Dev train models
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
moderation_classifier/eval_BERT.py
+0
-8
0 additions, 8 deletions
moderation_classifier/eval_BERT.py
src/preprocessing_text.py
+1
-5
1 addition, 5 deletions
src/preprocessing_text.py
with
1 addition
and
13 deletions
moderation_classifier/eval_BERT.py
+
0
−
8
View file @
9fcfed88
...
...
@@ -50,12 +50,7 @@ def main(train_logs: Union[str, os.PathLike]):
df_de
.
text
=
text_proc
comon_topics
=
tl
.
get_comments_per_topic
(
df_de
)
df_de
=
df_de
[:
10000
]
# Load tokenizer and model
start
=
timeit
.
timeit
()
tokenizer
=
AutoTokenizer
.
from_pretrained
(
"
bert-base-german-cased
"
)
model
=
TFAutoModelForSequenceClassification
.
from_pretrained
(
pretrained_model_name_or_path
=
path_model
)
...
...
@@ -102,9 +97,6 @@ def main(train_logs: Union[str, os.PathLike]):
results_t
[
t
][
"
f1
"
]
=
f1
results_t
[
t
][
"
precision
"
]
=
precision
results_t
[
t
][
"
recall
"
]
=
recall
end
=
timeit
.
timeit
()
print
(
end
-
start
)
# Compute rejection rate
reject_rate_all
=
np
.
round
(
df_de
.
label
.
mean
(),
4
)
*
100
...
...
This diff is collapsed.
Click to expand it.
src/preprocessing_text.py
+
1
−
5
View file @
9fcfed88
...
...
@@ -133,12 +133,8 @@ class TextLoader(object):
#df = df.rename(columns={"rejected": "label"})
topics
=
Counter
(
df
[
"
topic
"
]).
most_common
(
num_topic
)
comm_per_topic
=
dict
()
for
t
in
topics
:
df_topic
=
df
[
df
.
topic
==
t
[
0
]]
comm_per_topic
[
t
[
0
]]
=
df_topic
return
comm_per_
topic
return
topic
s
def
find_duplicate_comments
(
self
,
df
:
pd
.
DataFrame
)
->
np
.
ndarray
:
"""
"
...
...
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