event-budget-prediction / postprocessing.py
ov-pinka's picture
Upload 14 files
f4642b6 verified
import prediction
def compute_income_breakdown(income_transformed, exh_num, lambdas):
income = prediction.inv_yeojohnson(income_transformed, lambdas)
if exh_num > 0:
reg_income_transformed = 0.995 * income_transformed
else:
reg_income_transformed = income_transformed
reg_income = prediction.inv_yeojohnson(reg_income_transformed, lambdas)
# Exhibit income
tiers = [
(0, 20, 1100),
(20, 35, 1750),
(35, 50, 1500),
(50, float('inf'), 5300)
]
exh = 0
for start, end, price in tiers:
if exh_num > start:
units = min(exh_num, end) - start
exh += units * price
else:
break
exh = min(exh, income - reg_income)
# Sponsorship
sponsor = min(exh_num * 2300, income - reg_income - exh)
if exh_num > 50:
sponsor = min(50 * 2300, income - reg_income - exh)
# Adjust
other = income - reg_income - exh - sponsor
reg_income += other
return income, reg_income, exh#, sponsor
def compute_expenses(income):
expenses = income * 0.85
return {
"Total Expenses": expenses,
"Social Functions Expenses": expenses * 0.35,
"Local Arrangements Expenses": expenses * 0.25,
"Management Service Expenses": expenses * 0.09,
"Committee Expenses": expenses * 0.06,
"Administration": expenses * 0.06,
"Social Admin Fees": expenses * 0.06,
"Publication Expenses": expenses * 0.05,
"Program Expenses": expenses * 0.05,
}