I face a problem of estimating a joint probability for independent variables in a simple setup. Currently I have an array of 100 random variables and I would like to obtain their joint probability without failing into the underflow problem. Any ideas how to achieve this goal in numpy? If possible?
If not could someone please explain me further the role of NumPy routine (logaddexp) as I thought it might be a help for me in such situation.
logaddexp
lets you expand the range (reducing the precision) of representable values by storing and processing their logarithm instead.You just need to go through your code changing
**
to*
,*
to+
and+
tonp.logaddexp
, and convert back withnp.exp
at the end.The normal 64-bit double-precision floating point has least positive normal value 2.2E-308; storing logs gives you an effective least positive normal 1E-(1.7E308).