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
d49636a3
Commit
d49636a3
authored
Nov 06, 2023
by
lintangsutawika
Browse files
brier score is working for N-sized class
parent
a76754ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
lm_eval/api/metrics.py
lm_eval/api/metrics.py
+3
-5
No files found.
lm_eval/api/metrics.py
View file @
d49636a3
...
...
@@ -109,12 +109,10 @@ def ter(items):
@
register_aggregation
(
"brier_score"
)
def
brier_score
(
items
):
# This is a passthrough function
gold
=
list
(
zip
(
*
items
))[
0
]
gold_one_hot
=
np
.
eye
(
max
(
gold
)
+
1
)[
gold
]
gold
,
predictions
=
list
(
zip
(
*
items
))
gold
=
list
(
gold
)
gold_one_hot
=
np
.
eye
(
np
.
max
(
gold
)
+
1
)[
gold
]
predictions
=
list
(
zip
(
*
items
))[
1
]
print
(
"predictions"
,
prediction
)
print
(
"gold_one_hot"
,
gold_one_hot
)
import
sys
;
sys
.
exit
()
return
np
.
mean
(
np
.
sum
((
predictions
-
gold_one_hot
)
**
2
,
axis
=
1
))
...
...
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