Re: [Numpy-discussion] numpy.power -> numpy.random.choice Probabilities don't sum to 1

2015-12-19 Thread Andy Ray Terrel
A simple fix would certainly by pass the check in random.choice, but I don't know how to get that. So let's focus on the summation. I believe you are hitting an instability in summing small numbers as a power to 10th order would produce. Here is an example: mymatrix =

Re: [Numpy-discussion] numpy.power -> numpy.random.choice Probabilities don't sum to 1

2015-12-18 Thread Nathaniel Smith
On Fri, Dec 18, 2015 at 1:25 PM, Ryan R. Rosario wrote: > Hi, > > I have a matrix whose entries I must raise to a certain power and then > normalize by row. After I do that, when I pass some rows to > numpy.random.choice, I get a ValueError: probabilities do not sum to 1. >

[Numpy-discussion] numpy.power -> numpy.random.choice Probabilities don't sum to 1

2015-12-18 Thread Ryan R. Rosario
Hi, I have a matrix whose entries I must raise to a certain power and then normalize by row. After I do that, when I pass some rows to numpy.random.choice, I get a ValueError: probabilities do not sum to 1. I understand that floating point is not perfect, and my matrix is so large that I