[Numpy-discussion] PR 8053 np.random.multinomial tolerance param

Alex Beloi a.beloi at samsung.com
Mon Sep 26 14:52:28 EDT 2016


Hello,

 

Pull Request: https://github.com/numpy/numpy/pull/8053

 

I would like to expose a tolerance parameter for the function
numpy.random.multinomial.

 

The function `multinomial(n, pvals, size=None)` correctly raises exception
when `sum(pvals) > 1 + 1e-12` as these values should sum to 1. However,
other libraries often cannot or do not guarantee such level of precision.

 

Specifically, I have encountered issues with tensorflow function
tf.nn.softmax, which is expected to output a tensor whose values sum to 1,
but often with precision of only 1e-8. 

 

I propose to expose the `1e-12` tolerance to a non-negative float parameter
with default value `1e-12`.

 

Alex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160926/e48339f6/attachment.html>


More information about the NumPy-Discussion mailing list