-
Couldn't load subscription status.
- Fork 199
Open
Description
Hi
I am trying to increase my budget for the next fiscal year from 40m to 45m (all media channels except crm_push and crm_email), but after adding current budget with the delta optimisation - the sum is the same?
budget_optimizer = optimizer.BudgetOptimizer(mmm)
spend_constraints_lower = [0.3] * num_media_channels
spend_constraints_upper = [0.3] * num_media_channels
# Budget for CRM not changed so setting these to 0
crm_email_index = media_channel_list.index('crm_email')
crm_push_index = media_channel_list.index('crm_push')
for arr in (spend_constraints_lower, spend_constraints_upper):
arr[crm_email_index] = 0.0
arr[crm_push_index] = 0.0
budget = 45_500_000
optimization_results = budget_optimizer.optimize(
fixed_budget=True,
budget=budget,
start_date='2024-07-01',
end_date='2025-06-23',
spend_constraint_lower=spend_constraints_lower,
spend_constraint_upper=spend_constraints_upper
)
optimization_results.output_optimization_summary(optimisation_output_filename, output_dir)
optimized_spend = optimization_results._get_delta_data('spend')
optimized_spend_indexed = optimized_spend.set_index('channel')
# Joined back to previous budget
sm = analyzer.Analyzer(mmm).summary_metrics(
confidence_level=0.8,
selected_times=list(mmm.input_data.time[-52:].data),
)
sm_df = pd.DataFrame(
data={
"channel": sm.channel[:-1],
"previous_spend": sm.spend[:-1]
}
)
df = sm_df.join(optimized_spend_indexed, on="channel", how='left')
df.loc[:, 'optimized_spend'] = df['previous_spend'] + df['spend']
df
So df['optimized_spend'].sum() is the same as df['previous_spend'].sum()
If this is not the right approach, how do I get the new optimised budget?
Metadata
Metadata
Assignees
Labels
No labels