Mock Samplable Set¶
Contains a MockSamplableSet class that mimicks the behavior of github.com/gstonge/SamplableSet but is less efficient.
-
class
epipack.mock_samplable_set.
MockSamplableSet
(min_weight, max_weight, weighted_elements=[], cpp_type='int')[source]¶ Bases:
object
A set of items that can be sampled with probability proportional to a corresponding item weight.
Mimicks the behavior of github.com/gstonge/SamplableSet without being as efficient.
Works similar to Python's set, with
__getitem__
,__setitem__
,__delitem__
,__iter__
,__len__
,__contains__
.- Parameters
-
items
¶ list of items in this set
- Type
numpy.ndarray
-
weights
¶ list of corresponding weights
- Type
numpy.ndarray