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
2cd7c834
Commit
2cd7c834
authored
1 year ago
by
Franziska Oschmann
Browse files
Options
Downloads
Patches
Plain Diff
Smaller changes in train scripts
parent
6728a32a
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/train_BERT.py
+1
-0
1 addition, 0 deletions
moderation_classifier/train_BERT.py
moderation_classifier/train_MNB.py
+3
-3
3 additions, 3 deletions
moderation_classifier/train_MNB.py
with
4 additions
and
3 deletions
moderation_classifier/train_BERT.py
+
1
−
0
View file @
2cd7c834
...
@@ -32,6 +32,7 @@ def save_logs(
...
@@ -32,6 +32,7 @@ def save_logs(
:param text_preprocessing: Boolean flag whether preprocessing was used or not
:param text_preprocessing: Boolean flag whether preprocessing was used or not
"""
"""
logs
=
dict
()
logs
=
dict
()
logs
[
"
path_repo
"
]
=
path_repo
logs
[
"
path_model
"
]
=
path
logs
[
"
path_model
"
]
=
path
logs
[
"
input_data
"
]
=
input_data
logs
[
"
input_data
"
]
=
input_data
logs
[
"
text_preprocessing
"
]
=
text_preprocessing
logs
[
"
text_preprocessing
"
]
=
text_preprocessing
...
...
This diff is collapsed.
Click to expand it.
moderation_classifier/train_MNB.py
+
3
−
3
View file @
2cd7c834
...
@@ -32,7 +32,7 @@ def create_pipeline():
...
@@ -32,7 +32,7 @@ def create_pipeline():
)
)
# define model
# define model
mnb
=
MultinomialNB
(
alpha
=
0.
0
1
)
mnb
=
MultinomialNB
(
alpha
=
0.1
)
# set pipeline
# set pipeline
pipe
=
Pipeline
([(
"
processor
"
,
tp
),
(
"
vectorizer
"
,
vectorizer
),
(
"
mnb
"
,
mnb
)])
pipe
=
Pipeline
([(
"
processor
"
,
tp
),
(
"
vectorizer
"
,
vectorizer
),
(
"
mnb
"
,
mnb
)])
...
@@ -102,16 +102,16 @@ def main(input_data: Union[str, os.PathLike]):
...
@@ -102,16 +102,16 @@ def main(input_data: Union[str, os.PathLike]):
# Load data and extract only text from tagesanzeiger
# Load data and extract only text from tagesanzeiger
print
(
"
Load and preprocess text
"
)
print
(
"
Load and preprocess text
"
)
remove_duplicates
=
Fals
e
remove_duplicates
=
Tru
e
min_num_words
=
3
min_num_words
=
3
tl
=
TextLoader
(
input_data
)
tl
=
TextLoader
(
input_data
)
df_de
=
tl
.
load_text_csv
(
df_de
=
tl
.
load_text_csv
(
newspaper
=
"
tagesanzeiger
"
,
newspaper
=
"
tagesanzeiger
"
,
lang
=
'
de
'
,
load_subset
=
False
,
load_subset
=
False
,
remove_duplicates
=
remove_duplicates
,
remove_duplicates
=
remove_duplicates
,
min_num_words
=
min_num_words
,
min_num_words
=
min_num_words
,
)
)
df_de
=
df_de
.
sample
(
50
)
# Prepare data for modeling
# Prepare data for modeling
text
=
df_de
.
text
text
=
df_de
.
text
...
...
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