Does scipy logsumexp () perform an underflow problem?

Is there a scipy logsumexp() hack implementation that prevents overflow by subtracting the maximum value found in the array from each element?

The explanation below is where m = maxval :

enter image description here

+5
source share
1 answer

You can check the source code defining logsumexp here . (Note that there is a link to the source on the document page ).

You will see:

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

So yes, scipy logsumexp subtracts the maximum from each element.

+8
source

Source: https://habr.com/ru/post/1201760/


All Articles