event-budget-prediction / inv_transform.py
ov-pinka's picture
Upload 7 files
6caaf18 verified
raw
history blame contribute delete
388 Bytes
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)