DERBACH/latent-rubric / tests /test_cluster_bootstrap.py
DERBACH's picture
download
raw
706 Bytes
import numpy as np
import pytest
from analysis.bootstrap import paired_cluster_mean
def test_unequal_cluster_sizes_preserve_example_mean():
a=np.zeros((2,4));b=np.array([[1,1,1,0],[1,1,1,0.]])
r=paired_cluster_mean(a,b,['a','a','a','b'],n=1000)
assert r['difference']==.75
assert r['difference']!=.5 # equal-prompt weighting is a different estimand
same=paired_cluster_mean(b,b,['a','a','a','b'],n=100)
assert same['ci95']==[0.,0.]
def test_missing_predictions_rejected():
with pytest.raises(ValueError):paired_cluster_mean([[np.nan]],[[1]],['p'],n=10)
def test_one_cluster_does_not_claim_ci():
assert paired_cluster_mean([[0,0]],[[1,1]],['p','p'],n=10)['ci95'] is None

Xet Storage Details

Size:
706 Bytes
·
Xet hash:
fc27ab2eb5676b93625c74fcdb32ac7c6051103b209a1133b16dc6ef7ebf3ff8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.