import numpy as np def inv_yeojohnson(value, lmbda): if value>= 0 and lmbda == 0: return np.exp(value) - 1 elif value >= 0 and lmbda != 0: return (value * lmbda + 1) ** (1 / lmbda) - 1 elif value < 0 and lmbda != 2: return 1 - (-(2 - lmbda) * value + 1) ** (1 / (2 - lmbda)) elif value < 0 and lmbda == 2: return 1 - np.exp(-value)