Open JZ3977 opened 3 months ago
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!
prices = jnp.ones(mmm.n_media_channels)
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]
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.xprices)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))
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.xprices)100,2) print(channel_names[x],": ", share, "%")
( 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))