【问题标题】:Does scipy logsumexp() deal with the underflow challenge?scipy logsumexp() 是否处理下溢挑战?
【发布时间】:2014-10-28 09:02:36
【问题描述】:

scipy 的 logsumexp() 实现是否包含通过从每个元素中减去数组中找到的最大值来防止下溢的 hack?

下面解释的那个,m = maxval:

【问题讨论】:

  • 我不会称之为黑客。除非浮点数也是 hack。

标签: python arrays numpy scipy natural-logarithm


【解决方案1】:

您可以检查定义logsumexp here 的源代码。 (请注意,the doc page 上有指向源的链接)。

你会看到:

a_max = a.max(axis=0)
...
out = log(sum(exp(a - a_max), axis=0))

所以是的,scipy 的 logsumexp 正在从每个元素中减去最大值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-11
    • 1970-01-01
    • 2017-10-23
    • 1970-01-01
    • 2018-07-01
    • 2011-03-20
    • 2014-07-08
    相关资源
    最近更新 更多