Table Of Contents
Table Of Contents


mxnet.test_utils.verify_generator(generator, buckets, probs, nsamples=1000000, nrepeat=5, success_rate=0.25, alpha=0.05)[source]

Verify whether the generator is correct using chi-square testing.

The test is repeated for “nrepeat” times and we check if the success rate is
above the threshold (25% by default).
  • generator (function) –
    A function that is assumed to generate i.i.d samples from a specific distribution.
    generator(N) should generate N random samples.
  • buckets (list of tuple or list of number) –
    The buckets to run the chi-square the test. Make sure that the buckets cover
    the whole range of the distribution. Also, the buckets must be in ascending order and have no intersection
  • probs (list or tuple) – The ground-truth probability of the random value fall in a specific bucket.
  • nsamples (int) – The number of samples to generate for the testing
  • nrepeat (int) – The times to repeat the test
  • success_rate (float) – The desired success rate
  • alpha (float) – The desired threshold for type-I error i.e. when a true null hypothesis is rejected

cs_ret_l – The p values of the chi-square test.

Return type: