Esempio n. 1
0
 def test_weighted_sample_unnormalized(self):
     disc = Discrete(4)
     weights = np.array([1., 2., 3., 5.])
     res = disc.weighted_sample(weights)
     assert res >= 0 and res < disc.n
Esempio n. 2
0
 def test_weighted_sample(self):
     disc = Discrete(4)
     weights = [0.1, 0.2, 0.3, 0.4]
     res = disc.weighted_sample(weights)
     assert res >= 0 and res < disc.n