Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the inverse of numpy's log1p()?

Tags:

python

numpy

I transformed my data with:

Y = np.log1p(Y)

What is the formula to transform the values back to the natural values?

back  = np.e**Y

This did not work.

like image 662
Meiiso Avatar asked Apr 26 '18 18:04

Meiiso


1 Answers

You can use numpy.expm1() which is the inverse of numpy.log1p()

import numpy as np
Y = np.log1p(Y)
back = np.expm1(Y)
like image 125
pault Avatar answered Oct 06 '22 17:10

pault