The following editor will bring you a brief discussion on the usage scenarios of scipy.misc.logsumexp function in python. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look.
The input parameters of the scipy.misc.logsumexp function are (a, axis=None, b=None, keepdims=False, return_sign=False). The specific configuration can be found here. The returned value is np.log(np.sum(np.exp(a))).
What needs to be emphasized here is the scenario of using this function:
Generally speaking, this function is mainly used for calculations of very small values. (such as Monte Carlo sampling samples). In this case, keeping the data in log processing is a must. So at this time, if you want to accumulate and sum the data in the array, you need to calculate log(sum(exp(a))) like this, but doing so will cause some accuracy problems, and this
problem scipy.misc .logsumexp was introduced and solved, so you can directly use the scipy.misc.logsumexp function for summing small data.
Reference: https://github.com/numpy/numpy/issues/5652
The above is a brief discussion brought by the editor on the use of scipy.misc.logsumexp function in python The entire scene is now available. I hope everyone will support the PHP Chinese website~