Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EDdA Classification
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projet GEODE
EDdA Classification
Commits
1373e8e0
Commit
1373e8e0
authored
3 years ago
by
Ludovic Moncla
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
04dd1c35
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
evaluate_model.py
+0
-11
0 additions, 11 deletions
evaluate_model.py
experimentsClassicClassifiers.py
+16
-33
16 additions, 33 deletions
experimentsClassicClassifiers.py
with
16 additions
and
44 deletions
evaluate_model.py
+
0
−
11
View file @
1373e8e0
...
@@ -57,14 +57,3 @@ def evaluate_model(clf, X_test, y_test, y_pred, valid_y, classes, classesName, p
...
@@ -57,14 +57,3 @@ def evaluate_model(clf, X_test, y_test, y_pred, valid_y, classes, classesName, p
plt
.
savefig
(
pathSave
)
plt
.
savefig
(
pathSave
)
return
df
,
accuracy
,
weighted_avg
return
df
,
accuracy
,
weighted_avg
import
seaborn
as
sns
import
matplotlib.pyplot
as
plt
from
sklearn.metrics
import
confusion_matrix
#y_true = [2, 0, 2, 2, 0, 1]
#y_pred = [0, 0, 2, 2, 0, 2]
#cf_matrix = confusion_matrix(y_true, y_pred)
#sns.heatmap(cf_matrix, annot=True)
#import matplotlib.pyplot as plt
#plt.show()
This diff is collapsed.
Click to expand it.
experimentsClassicClassifiers.py
+
16
−
33
View file @
1373e8e0
...
@@ -96,44 +96,27 @@ for columnInput in [columnText, 'firstParagraph']:
...
@@ -96,44 +96,27 @@ for columnInput in [columnText, 'firstParagraph']:
grid_param_name
,
grid_param
=
tmp_grid_params
grid_param_name
,
grid_param
=
tmp_grid_params
print
(
clf_name
,
clf
,
grid_param_name
,
grid_param
)
print
(
clf_name
,
clf
,
grid_param_name
,
grid_param
)
model_file_name
=
columnInput
+
'
_
'
+
feature_technique_name
+
'
_
'
+
clf_name
+
str
(
minOfInstancePerClass
)
+
'
_
'
+
str
(
maxOfInstancePerClass
)
+
"
.pkl
"
model_file_name
=
columnInput
+
'
_
'
+
feature_technique_name
+
'
_
'
+
clf_name
+
str
(
minOfInstancePerClass
)
+
'
_
'
+
str
(
maxOfInstancePerClass
)
+
"
.pkl
"
if
clf_name
==
'
bayes
'
:
if
feature_technique_name
==
'
doc2vec
'
:
if
clf_name
!=
'
bayes
'
:
continue
else
:
t_begin
=
time
.
time
()
# if model exist
if
os
.
path
.
isfile
(
os
.
path
.
join
(
'
./model
'
,
model_file_name
)):
with
open
(
model_file_name
,
'
rb
'
)
as
file
:
clf
=
pickle
.
load
(
file
)
else
:
#if model not exists we save
with
open
(
Pkl_Filename
,
'
wb
'
)
as
file
:
clf
.
fit
(
train_x
,
train_y
)
pickle
.
dump
(
clf
,
file
)
t_end
=
time
.
time
()
training_time
=
t_end
-
t_begin
y_pred
=
clf
.
predict
(
test_x
)
else
:
clf
=
GridSearchCV
(
clf
,
grid_param
,
refit
=
True
,
verbose
=
3
)
clf
=
GridSearchCV
(
clf
,
grid_param
,
refit
=
True
,
verbose
=
3
)
t_begin
=
time
.
time
()
else
if
feature_technique_name
==
'
doc2vec
'
:
continue
t_begin
=
time
.
time
()
if
os
.
path
.
isfile
(
os
.
path
.
join
(
'
./model
'
,
model_file_name
)):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
'
./model
'
,
model_file_name
)):
with
open
(
model_file_name
,
'
rb
'
)
as
file
:
with
open
(
model_file_name
,
'
rb
'
)
as
file
:
clf
=
pickle
.
load
(
file
)
clf
=
pickle
.
load
(
file
)
else
:
else
:
with
open
(
Pkl_Filename
,
'
wb
'
)
as
file
:
with
open
(
Pkl_Filename
,
'
wb
'
)
as
file
:
clf
.
fit
(
train_x
,
train_y
)
clf
.
fit
(
train_x
,
train_y
)
pickle
.
dump
(
clf
,
file
)
pickle
.
dump
(
clf
,
file
)
t_end
=
time
.
time
()
t_end
=
time
.
time
()
training_time
=
t_end
-
t_begin
training_time
=
t_end
-
t_begin
y_pred
=
clf
.
predict
(
test_x
)
y_pred
=
clf
.
predict
(
test_x
)
#evaluate model
#evaluate model
file_name_report
=
columnInput
+
'
_
'
+
feature_technique_name
+
'
_
'
+
clf_name
file_name_report
=
columnInput
+
'
_
'
+
feature_technique_name
+
'
_
'
+
clf_name
...
...
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