event-budget-prediction / prediction.py
ov-pinka's picture
Upload 14 files
f4642b6 verified
Raw History Blame Contribute Delete
544 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)
def predict_income(model, df):
return model.predict(df)[0]
#def inverse_transform(value, lambdas):
# return inv_yeojohnson(value, lambdas)