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 12:53:29 -0600
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
98ff15c37e101d022525a6fec2c86e357969f121
98ff15c3
1 parent
af5d0607
Conditional Random Fields
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
training-validation-v1.py
training-validation-v1.py
View file @
98ff15c
...
...
@@ -234,7 +234,7 @@ if __name__ == "__main__":
# crf = rs.best_estimator_
nameReport
=
options
.
trainingFile
.
replace
(
'.txt'
,
'.fStopWords_'
+
str
(
options
.
excludeStopWords
)
+
'.fSymbols_'
+
str
(
options
.
excludeSymbols
)
+
'.txt'
)
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l"
,
"report_"
+
nameReport
),
mode
=
"w"
)
as
oFile
:
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l
p
"
,
"report_"
+
nameReport
),
mode
=
"w"
)
as
oFile
:
oFile
.
write
(
"********** TRAINING **********
\n
"
)
oFile
.
write
(
"Training file: "
+
options
.
trainingFile
+
'
\n
'
)
oFile
.
write
(
'
\n
'
)
...
...
@@ -256,14 +256,14 @@ if __name__ == "__main__":
print
(
"*********************************"
)
name
=
options
.
trainingFile
.
replace
(
'.txt'
,
'.fStopWords_'
+
str
(
options
.
excludeStopWords
)
+
'.fSymbols_'
+
str
(
options
.
excludeSymbols
)
+
'.txt'
)
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l"
,
"y_pred_"
+
name
),
"w"
)
as
oFile
:
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l
p
"
,
"y_pred_"
+
name
),
"w"
)
as
oFile
:
for
y
in
y_pred
:
oFile
.
write
(
str
(
y
)
+
'
\n
'
)
print
(
"*********************************"
)
name
=
options
.
trainingFile
.
replace
(
'.txt'
,
'.fStopWords_'
+
str
(
options
.
excludeStopWords
)
+
'.fSymbols_'
+
str
(
options
.
excludeSymbols
)
+
'.txt'
)
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l"
,
"y_test_"
+
name
),
"w"
)
as
oFile
:
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l
p
"
,
"y_test_"
+
name
),
"w"
)
as
oFile
:
for
y
in
y_test
:
oFile
.
write
(
str
(
y
)
+
'
\n
'
)
...
...
@@ -272,7 +272,7 @@ if __name__ == "__main__":
# labels = list(crf.classes_)
# labels.remove('O')
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l"
,
"report_"
+
nameReport
),
mode
=
"a"
)
as
oFile
:
with
open
(
os
.
path
.
join
(
options
.
outputPath
,
"reports-l
p
"
,
"report_"
+
nameReport
),
mode
=
"a"
)
as
oFile
:
oFile
.
write
(
'
\n
********** EVALUATION **********
\n
'
)
oFile
.
write
(
"Flat F1: "
+
str
(
metrics
.
flat_f1_score
(
y_test
,
y_pred
,
average
=
'weighted'
,
labels
=
labels
)))
oFile
.
write
(
'
\n
'
)
...
...
Please
register
or
login
to post a comment