Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EDdA Classification
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projet GEODE
EDdA Classification
Merge requests
!3
Branch dev
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Branch dev
branch_dev
into
master
Overview
0
Commits
3
Pipelines
0
Changes
1
Merged
Branch dev
Ludovic Moncla
requested to merge
branch_dev
into
master
Jun 8, 2021
Overview
0
Commits
3
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
master
version 1
1a99bf70
Jun 8, 2021
master (base)
and
latest version
latest version
60bfb622
3 commits,
Jun 8, 2021
version 1
1a99bf70
2 commits,
Jun 8, 2021
1 file
+
3
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
experimentsClassicClassifiers.py
+
3
−
4
View file @ 60bfb622
Edit in single-file editor
Open in Web IDE
Show full file
@@ -51,9 +51,8 @@ if not os.path.exists('models'):
# Reading data and preprocessings steps
preprocessor
=
Preprocessor
()
df
_original
=
pd
.
read_csv
(
dataPath
)
df
=
pd
.
read_csv
(
dataPath
)
df
=
df_original
[[
columnClass
,
columnText
]].
copy
()
df
=
remove_weak_classes
(
df
,
columnClass
,
minOfInstancePerClass
)
df
=
resample_classes
(
df
,
columnClass
,
maxOfInstancePerClass
)
@@ -73,7 +72,7 @@ for columnInput in [columnText, 'firstParagraph']:
print
(
'
Process:
'
+
columnInput
)
extractor
=
feature_extractor
(
df
,
column
Tex
t
,
columnClass
)
extractor
=
feature_extractor
(
df
,
column
Inpu
t
,
columnClass
)
features_techniques
=
[
(
'
counter
'
,
extractor
.
count_vect
(
max_df
=
vectorization_max_df
,
min_df
=
vectorization_min_df
,
numberOfFeatures
=
vectorization_numberOfFeatures
)),
@@ -122,10 +121,10 @@ for columnInput in [columnText, 'firstParagraph']:
file_name_report
=
columnInput
+
'
_
'
+
feature_technique_name
+
'
_
'
+
clf_name
report
,
accuracy
,
weighted_avg
=
evaluate_model
(
clf
,
test_x
,
valid_y
,
y_pred
,
valid_y
,
[
str
(
e
)
for
e
in
encoder
.
transform
(
encoder
.
classes_
)],
encoder
.
classes_
,
os
.
path
.
join
(
'
reports
'
,
columnClass
,
dir_name_report
,
file_name_report
)
+
'
.pdf
'
)
report
.
to_csv
(
os
.
path
.
join
(
'
reports
'
,
columnClass
,
dir_name_report
,
file_name_report
+
'
.csv
'
))
with
open
(
os
.
path
.
join
(
'
reports
'
,
columnClass
,
dir_name_report
,
file_name_report
+
'
.txt
'
),
'
w
'
)
as
f
:
sys
.
stdout
=
f
# Change the standard output to the file we created.
print
(
report
)
print
(
'
accuracy : {}
'
.
format
(
accuracy
))
print
(
'
weighted_Precision : {}
'
.
format
(
weighted_avg
[
'
precision
'
]))
print
(
'
weighted_Recall : {}
'
.
format
(
weighted_avg
[
'
recall
'
]))
Loading