MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / logsumexp

Function logsumexp

numpy_ml/utils/misc.py:5–13  ·  view source on GitHub ↗

Redefine scipy.special.logsumexp see: http://bayesjumping.net/log-sum-exp-trick/

(log_probs, axis=None)

Source from the content-addressed store, hash-verified

3
4
5def logsumexp(log_probs, axis=None):
6 """
7 Redefine scipy.special.logsumexp
8 see: http://bayesjumping.net/log-sum-exp-trick/
9 """
10 _max = np.max(log_probs)
11 ds = log_probs - _max
12 exp_sum = np.exp(ds).sum(axis=axis)
13 return _max + np.log(exp_sum)
14
15
16def log_gaussian_pdf(x_i, mu, sigma):

Callers 6

log_likelihoodMethod · 0.90
_forwardMethod · 0.90
_backwardMethod · 0.90
_E_stepMethod · 0.90
_M_stepMethod · 0.90
_E_stepMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected