Skip to content

Commit

Permalink
Decrease success rate to make test more stable (apache#12092)
Browse files Browse the repository at this point in the history
I have added this test back to unit test coverage and decreased success rate even more, to make sure that fails would happen even more rare
  • Loading branch information
Ishitori authored and marcoabreu committed Aug 10, 2018
1 parent e0e3cf3 commit 71b1f5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/python/unittest/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,20 +447,20 @@ def test_uniform_generator():
verify_generator(generator=generator_mx_same_seed, buckets=buckets, probs=probs)

@with_seed()
@unittest.skip('Flaky test, tracked in: https://github.com/apache/incubator-mxnet/issues/9856')
def test_gamma_generator():
success_rate = 0.05
ctx = mx.context.current_context()
for dtype in ['float16', 'float32', 'float64']:
for kappa, theta in [(0.5, 1.0), (1.0, 5.0)]:
print("ctx=%s, dtype=%s, Shape=%g, Scale=%g:" % (ctx, dtype, kappa, theta))
buckets, probs = gen_buckets_probs_with_ppf(lambda x: ss.gamma.ppf(x, a=kappa, loc=0, scale=theta), 5)
generator_mx = lambda x: mx.nd.random.gamma(kappa, theta, shape=x, ctx=ctx, dtype=dtype).asnumpy()
verify_generator(generator=generator_mx, buckets=buckets, probs=probs)
verify_generator(generator=generator_mx, buckets=buckets, probs=probs, success_rate=success_rate)
generator_mx_same_seed = \
lambda x: np.concatenate(
[mx.nd.random.gamma(kappa, theta, shape=x // 10, ctx=ctx, dtype=dtype).asnumpy()
for _ in range(10)])
verify_generator(generator=generator_mx_same_seed, buckets=buckets, probs=probs)
verify_generator(generator=generator_mx_same_seed, buckets=buckets, probs=probs, success_rate=success_rate)

@with_seed()
def test_exponential_generator():
Expand Down

0 comments on commit 71b1f5c

Please sign in to comment.