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
Post a Comment