Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Budget Optimization #317

Open
JZ3977 opened this issue Mar 29, 2024 · 0 comments
Open

Budget Optimization #317

JZ3977 opened this issue Mar 29, 2024 · 0 comments

Comments

@JZ3977
Copy link

JZ3977 commented Mar 29, 2024

Hi can someone help me with the below?

  1. Est. budget for each channel in solution look all the same 2)the for loop is not working

Thanks!

Budget Optimization

prices = jnp.ones(mmm.n_media_channels)

starting with the same average weekly budget

n_time_periods = 10
budget = jnp.sum(media_data.mean(axis=0))*n_time_periods
extra_features_forecast = extra_features_scaler.transform(extra_features_test)[:n_time_periods]

run budget optimization

solution = optimize_media.find_optimal_budgets(
n_time_periods = n_time_periods,
media_mix_model = mmm,
extra_features=extra_features_forecast,
budget=budget,
prices=prices,
media_scaler=media_scaler,
target_scaler=target_scaler,)

for x in range(len(solution.x)):
share=round(solution.x[x]/ jnp.sum(solution.x*prices)*100,2)
print(channel_names[x],": ", share, "%")

solution

( message: Positive directional derivative for linesearch
success: False
status: 8
fun: -775541.283972166
x: [ 1.200e+01 1.200e+01 1.200e+01 1.200e+01 1.200e+01
1.200e+01 1.200e+01]
nit: 5
jac: [-1.285e+04 -5.411e+03 -1.743e+04 -6.435e+04 -3.987e+03
-6.294e+03 -8.593e+02]
nfev: 15
njev: 1,
Array(-7.94672769e+10, dtype=float64),
Array([1458417.2, 1458417.2, 1458417.2, 1458417.2, 1458417.2, 1458417.2,
1458417.2], dtype=float32))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant