Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Don-t-NLP-Me
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
Service Desk
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
Chen, Yitang
Don-t-NLP-Me
Commits
452a6529
Commit
452a6529
authored
1 year ago
by
mmzk1526
Browse files
Options
Downloads
Patches
Plain Diff
F1 by keyword
parent
21039d03
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
evaluation.py
+14
-0
14 additions, 0 deletions
evaluation.py
with
14 additions
and
0 deletions
evaluation.py
+
14
−
0
View file @
452a6529
...
...
@@ -115,10 +115,24 @@ def f1_by_input_length(split: int = 5) -> dict[tuple[int, int], float]:
return
results
def
f1_by_keyword
()
->
dict
[
str
,
float
]:
keywords
=
combined
[
"
keyword
"
].
unique
()
result_dict
=
{}
f1
=
load
(
"
f1
"
)
for
keyword
in
keywords
:
cur
=
combined
[
combined
[
"
keyword
"
]
==
keyword
]
print
(
f
'
{
keyword
}
has
{
len
(
cur
)
}
entries
'
)
result_dict
[
keyword
]
=
f1
.
compute
(
predictions
=
cur
[
"
pcl
"
].
to_list
(),
references
=
cur
[
"
is_patronising
"
].
to_list
())
return
result_dict
if
__name__
==
'
__main__
'
:
print
(
"
F1:
"
,
f1_score
())
print
(
"
Recall:
"
,
recall
())
print
(
"
Precision:
"
,
precision
())
print
(
"
F1 by input length (fixed):
"
,
f1_by_input_length_fixed
())
print
(
"
F1 by keyword:
"
,
f1_by_keyword
())
for
i
in
range
(
2
,
17
):
print
(
f1_by_input_length
(
i
))
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