natural-logarithm

Does scipy logsumexp() deal with the underflow challenge?

耗尽温柔 提交于 2019-12-01 18:20:42
Does the scipy's logsumexp() implementation include the hack that prevents underflow by subtracting the maximum found value in the array from each element? The one explained here below, where m = maxval : You can inspect the source code defining logsumexp here . (Note that there is a link to the source on the doc page ). You'll see: a_max = a.max(axis=0) ... out = log(sum(exp(a - a_max), axis=0)) So yes, scipy's logsumexp is subtracting the maximum from each element. 来源: https://stackoverflow.com/questions/25651480/does-scipy-logsumexp-deal-with-the-underflow-challenge