Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nerval
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Named Entity Recognition
nerval
Commits
ac6c3400
Commit
ac6c3400
authored
3 years ago
by
Charlotte Mauvezin
Committed by
Blanche Miret
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Adding a line with the mean total for the precision, the recall and the f1...
parent
0061dab0
No related branches found
No related tags found
1 merge request
!12
Adding a line with the mean total for the precision, the recall and the f1...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nerval/evaluate.py
+19
-3
19 additions, 3 deletions
nerval/evaluate.py
with
19 additions
and
3 deletions
nerval/evaluate.py
+
19
−
3
View file @
ac6c3400
...
...
@@ -514,7 +514,6 @@ def run(annotation: str, prediction: str, threshold: int, verbose: bool) -> dict
Each measure is given at document level, global score is a micro-average across entity types.
"""
# Get string and list of labels per character
annot
=
parse_bio
(
annotation
)
predict
=
parse_bio
(
prediction
)
...
...
@@ -570,6 +569,10 @@ def run_multiple(file_csv, folder, threshold, verbose):
if
os
.
path
.
isdir
(
folder
):
list_bio_file
=
glob
.
glob
(
str
(
folder
)
+
"
/**/*.bio
"
,
recursive
=
True
)
count
=
0
precision
=
0
recall
=
0
f1
=
0
for
row
in
list_cor
:
annot
=
None
predict
=
None
...
...
@@ -582,11 +585,24 @@ def run_multiple(file_csv, folder, threshold, verbose):
predict
=
file
if
annot
and
predict
:
count
+=
1
print
(
os
.
path
.
basename
(
predict
))
run
(
annot
,
predict
,
threshold
,
verbose
)
scores
=
run
(
annot
,
predict
,
threshold
,
verbose
)
precision
+=
scores
[
"
All
"
][
"
P
"
]
recall
+=
scores
[
"
All
"
][
"
R
"
]
f1
+=
scores
[
"
All
"
][
"
F1
"
]
print
()
else
:
raise
f
"
No file found for files
{
annot
}
,
{
predict
}
"
raise
Exception
(
f
"
No file found for files
{
annot
}
,
{
predict
}
"
)
if
count
:
print
(
"
Average scores in all corpus (mean of final files scores)
\n
"
f
"
* Precision:
{
round
(
precision
/
count
,
3
)
}
\n
"
f
"
* Recall:
{
round
(
recall
/
count
,
3
)
}
\n
"
f
"
* F1:
{
round
(
f1
/
count
,
3
)
}
\n
"
)
else
:
raise
Exception
(
"
No file were counted
"
)
else
:
raise
Exception
(
"
the path indicated does not lead to a folder.
"
)
...
...
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