Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Carlos-Francisco Méndez-Cruz
/
conditional-random-fields
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Carlos-Francisco Méndez-Cruz
2019-02-14 02:31:26 -0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9562445aab3c52b7a8ff86482735eb675b91eb74
9562445a
1 parent
8ba825f9
Conditional Random Fields
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
training-validation-v1.py
training-validation-v1.py
View file @
9562445
...
...
@@ -235,13 +235,10 @@ if __name__ == "__main__":
nameReport
=
options
.
trainingFile
.
replace
(
'.txt'
,
'.fStopWords_'
+
str
(
options
.
excludeStopWords
)
+
'.fSymbols_'
+
str
(
options
.
excludeSymbols
)
+
'.txt'
)
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports"
,
"report_"
+
nameReport
),
mode
=
"w"
)
as
oFile
:
oFile
.
write
(
"********** TRAINING
AND TESTING REPORT
**********
\n
"
)
oFile
.
write
(
"********** TRAINING **********
\n
"
)
oFile
.
write
(
"Training file: "
+
options
.
trainingFile
+
'
\n
'
)
oFile
.
write
(
'
\n
'
)
oFile
.
write
(
"Model: {}"
.
format
(
crf
))
#oFile.write('best params:' + str(crf.best_params_) + '\n')
#oFile.write('best CV score:' + str(crf.best_score_) + '\n')
#oFile.write('model size: {:0.2f}M\n'.format(crf.best_estimator_.size_ / 1000000))
print
(
"Training done in:
%
fs"
%
(
time
()
-
t0
))
t0
=
time
()
...
...
@@ -276,7 +273,7 @@ if __name__ == "__main__":
# labels.remove('O')
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports"
,
"report_"
+
nameReport
),
mode
=
"a"
)
as
oFile
:
oFile
.
write
(
'
\n
'
)
oFile
.
write
(
'
********** EVALUATION **********
\n
'
)
oFile
.
write
(
"Flat F1: "
+
str
(
metrics
.
flat_f1_score
(
y_test
,
y_pred
,
average
=
'weighted'
,
labels
=
labels
)))
oFile
.
write
(
'
\n
'
)
# labels = list(crf.classes_)
...
...
Please
register
or
login
to post a comment