ChaiBapchya commented on a change in pull request #13543: Chi_square_check for
discrete distribution fix
URL: https://github.com/apache/incubator-mxnet/pull/13543#discussion_r239260946
##########
File path: python/mxnet/test_utils.py
##########
@@ -1911,12 +1911,15 @@ def chi_square_check(generator, buckets, probs,
nsamples=1000000):
if continuous_dist:
sample_bucket_ids = np.searchsorted(buckets_npy, samples, side='right')
else:
- sample_bucket_ids = samples
+ sample_bucket_ids = np.array(samples)
if continuous_dist:
sample_bucket_ids = sample_bucket_ids // 2
obs_freq = np.zeros(shape=len(buckets), dtype=np.int)
- for i in range(len(buckets)):
- obs_freq[i] = (sample_bucket_ids == i).sum()
+ for i, _ in enumerate(buckets):
+ if continuous_dist:
+ obs_freq[i] = (sample_bucket_ids == i).sum()
+ else:
+ obs_freq[i] = (sample_bucket_ids == buckets[i]).sum()
Review comment:
nope coz for discrete_distribution bucketing is different from the way its
done in continuous.
for continuous buckets are given like [0,4],[5,9]
for discrete buckets are numbers [0,1,2,3,4,5,6,7,8,9]
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services