File size: 395 Bytes
c95c7b0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import pytest
import random
import lm_eval.api.metric as metrics
from lm_eval.api.utils import DEFAULT_SEED
def test_bootstrapping():
random.seed(DEFAULT_SEED)
arr = [random.random() for _ in range(1000)]
expected = metrics.mean_stderr(arr)
bootstrapped = metrics.bootstrap_stderr(metrics.mean, arr, iters=100000)
assert bootstrapped == pytest.approx(expected, abs=1e-4)
|