python - numpy multinomial function returns value error -


i using numpy.random.multinomial(1,val) numpymultinomial, val 1-d numpy array. function gives following error:

valueerror('sum(pvals[:-1]) > 1.0',)

however, checked sum of input array val using val.sum() , sums 1. don't know if multinomial function has bug. can 1 me out this. alternatively, there other python module can use sampling using multinomial distribution?

i found strange behaviour due negative values in array val. had case val summed 0.9999996, contained negative element , due multinomial function throws valueerror, misleading of course because sum never exceeded 1.


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -