MCPcopy Create free account
hub / github.com/Open-Quant/openquant / test_sampling_contracts

Function test_sampling_contracts

python/tests/test_bindings_contract.py:61–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59
60def test_sampling_contracts():
61 label_endtime = [(0, 2), (1, 3), (2, 4)]
62 bar_index = [0, 1, 2, 3, 4]
63 ind_mat = openquant.sampling.get_ind_matrix(label_endtime, bar_index)
64 uniq = openquant.sampling.get_ind_mat_average_uniqueness(ind_mat)
65 samples = openquant.sampling.seq_bootstrap(ind_mat, sample_length=4, warmup_samples=[0, 1])
66
67 assert len(ind_mat) == len(bar_index)
68 assert len(ind_mat[0]) == len(label_endtime)
69 assert 0.0 <= uniq <= 1.0
70 assert len(samples) == 4
71 assert all(0 <= i < len(label_endtime) for i in samples)
72
73 seeded = openquant.sampling.seq_bootstrap(ind_mat, sample_length=50, random_state=3)
74 assert seeded == openquant.sampling.seq_bootstrap(ind_mat, sample_length=50, random_state=3)
75 assert seeded != openquant.sampling.seq_bootstrap(ind_mat, sample_length=50, random_state=4)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected