Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
b5067932
Commit
b5067932
authored
May 12, 2024
by
JessicaOjo
Browse files
update afrixnli tasks
parent
b84c8c9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
lm_eval/tasks/afrixnli/en-direct/utils.py
lm_eval/tasks/afrixnli/en-direct/utils.py
+18
-0
No files found.
lm_eval/tasks/afrixnli/en-direct/utils.py
0 → 100644
View file @
b5067932
from
sklearn.metrics
import
f1_score
def
doc_to_target
(
doc
):
replacements
=
{
0
:
'True'
,
1
:
'Neither'
,
2
:
'False'
}
return
replacements
[
doc
[
"label"
]]
def
weighted_f1_score
(
items
):
unzipped_list
=
list
(
zip
(
*
items
))
golds
=
unzipped_list
[
0
]
preds
=
unzipped_list
[
1
]
fscore
=
f1_score
(
golds
,
preds
,
average
=
"weighted"
)
return
fscore
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment