MCPcopy Index your code
hub / github.com/shenweichen/GraphEmbedding / simulate

Function simulate

examples/alias.py:19–26  ·  view source on GitHub ↗
(size=100, sample_count=10000)

Source from the content-addressed store, hash-verified

17
18
19def simulate(size=100, sample_count=10000):
20 truth = gen_prob_dist(size)
21 accept, alias = create_alias_table(truth)
22
23 sampled = np.zeros(size)
24 for _ in range(sample_count):
25 sampled[alias_sample(accept, alias)] += 1
26 return sampled / np.sum(sampled), truth
27
28
29def main(smoke=False, show=True):

Callers 1

mainFunction · 0.85

Calls 3

create_alias_tableFunction · 0.90
alias_sampleFunction · 0.90
gen_prob_distFunction · 0.85

Tested by

no test coverage detected