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
7f7673ec
Commit
7f7673ec
authored
May 10, 2021
by
Leo Gao
Browse files
Add comment
parent
59aff21d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
lm_eval/metrics.py
lm_eval/metrics.py
+6
-0
tests/test_misc.py
tests/test_misc.py
+1
-1
No files found.
lm_eval/metrics.py
View file @
7f7673ec
...
...
@@ -175,6 +175,12 @@ def _sacreformat(refs, preds):
def
bootstrap_stderr
(
f
,
xs
,
iters
=
100000
):
# this gives a biased estimate of the stderr (i.e w/ the mean, it gives something
# equivalent to stderr calculated without Bessel's correction in the stddev.
# Unfortunately, I haven't been able to figure out what the right correction is
# to make the bootstrap unbiased - i considered multiplying by sqrt(n/(n-1)) but
# that would be ad-hoc and I can't prove that that would actually be an unbiased estimator)
# Thankfully, shouldn't matter because our samples are pretty big usually anyways
rnd
=
random
.
Random
()
rnd
.
seed
(
42
)
res
=
[]
...
...
tests/test_misc.py
View file @
7f7673ec
...
...
@@ -7,6 +7,6 @@ def test_bootstrapping():
random
.
seed
(
42
)
arr
=
[
random
.
random
()
for
_
in
range
(
1000
)]
expected
=
metrics
.
mean_stderr
(
arr
)
bootstrapped
=
metrics
.
bootstrap_stderr
(
metrics
.
mean
,
arr
,
iters
=
100000
)
bootstrapped
=
metrics
.
bootstrap_stderr
(
metrics
.
mean
,
arr
)
assert
bootstrapped
==
pytest
.
approx
(
expected
,
abs
=
1e-4
)
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