in src/utils.py [0:0]
def select_item_with_prob(items_prob, n_inst):
"""Select an item random with given discrete pdf"""
items = []
for i in range(n_inst):
pick_prob = np.random.uniform()
values, probs = zip(*cum_sum_prob(items_prob))
idx = bisect_left(probs, pick_prob)
items.append(values[idx])
return items