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
5d662de1
Commit
5d662de1
authored
May 12, 2024
by
JessicaOjo
Browse files
add f1 score to mgsm
parent
d66d6ca1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lm_eval/tasks/afrimgsm/direct/utils.py
lm_eval/tasks/afrimgsm/direct/utils.py
+9
-0
lm_eval/tasks/afrimmlu/utils.py
lm_eval/tasks/afrimmlu/utils.py
+8
-0
No files found.
lm_eval/tasks/afrimgsm/direct/utils.py
0 → 100644
View file @
5d662de1
from
sklearn.metrics
import
f1_score
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
\ No newline at end of file
lm_eval/tasks/afrimmlu/utils.py
View file @
5d662de1
...
...
@@ -28,3 +28,11 @@ def doc_to_text(doc):
choice3
=
choices
[
2
],
choice4
=
choices
[
3
])
return
text
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
\ No newline at end of file
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