本文介绍了是否SciPy的logsumexp()处理下溢挑战?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请问SciPy的的 logsumexp()实施包括由每一个元素?
Does the scipy's logsumexp() implementation include the hack that prevents underflow by subtracting the maximum found value in the array from each element?
在一个在这里下面,解释其中 M = MAXVAL :
The one explained here below, where m = maxval:
推荐答案
您可以检查源$ C $ C定义 logsumexp 的此处。 (请注意,是到源链接上的商务部页)。
You can inspect the source code defining logsumexp here. (Note that there is a link to the source on the doc page).
您将看到:
a_max = a.max(axis=0) ... out = log(sum(exp(a - a_max), axis=0))所以,是的,SciPy的的 logsumexp 是减去每个元素的最大值。
So yes, scipy's logsumexp is subtracting the maximum from each element.
更多推荐
是否SciPy的logsumexp()处理下溢挑战?
发布评论