mxnet.test_utils.var_check¶
-
mxnet.test_utils.
var_check
(generator, sigma, nsamples=1000000)[source]¶ Test the generator by matching the variance. It will need a large number of samples and is not recommended to use
- We test the sample variance by checking if it falls inside the range
(sigma^2 - 3 * sqrt(2 * sigma^4 / (n-1)), sigma^2 + 3 * sqrt(2 * sigma^4 / (n-1)))
References:
@incollection{goucher2009beautiful, title={Beautiful Testing: Leading Professionals Reveal How They Improve Software}, author={Goucher, Adam and Riley, Tim}, year={2009}, chapter=10 }
Examples:
generator = lambda x: np.random.normal(0, 1.0, size=x) var_check_ret = var_check(generator, 0, 1.0)
- Parameters
generator (function) – The generator function. It’s expected to generate N i.i.d samples by calling generator(N).
sigma (float) –
nsamples (int) –
- Returns
ret – Whether the variance test succeeds
- Return type
bool