Table Of Contents
Table Of Contents

verify_generator

mxnet.test_utils.verify_generator(generator, buckets, probs, nsamples=1000000, nrepeat=5, success_rate=0.15)[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).
Parameters:
  • 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
Returns:

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

Return type:

list