meridian.analysis.optimizer.OptimizationResults

The optimized budget allocation.

This is a dataclass object containing datasets output from BudgetOptimizer . These datasets include:

  • nonoptimized_data : The non-optimized budget metrics (based on historical frequency).
  • nonoptimized_data_with_optimal_freq : The non-optimized budget metrics based on optimal frequency.
  • optimized_data : The optimized budget metrics.
  • optimization_grid : The grid information used for optimization.

The metrics (data variables) are: ROI, mROI, incremental outcome, CPIK.

Additionally, some intermediate values and referecences to the source fitted model and analyzer are also stored here. These are useful for visualizing and debugging.

meridian
The fitted Meridian model that was used to create this budget allocation.
analyzer
The analyzer bound to the model above.
spend_ratio
The spend ratio used to scale the non-optimized budget metrics to the optimized budget metrics.
spend_bounds
The spend bounds used to scale the non-optimized budget metrics to the optimized budget metrics.
nonoptimized_data
The non-optimized budget metrics (based on historical frequency).
nonoptimized_data_with_optimal_freq
The non-optimized budget metrics based on optimal frequency.
optimized_data
The optimized budget metrics.
optimization_grid
The grid information used for optimization.
template_env
A shared template environment bound to this optimized budget.

Methods

get_response_curves

View source

Calculates response curves, per budget optimization scenario.

This method is a wrapper for Analyzer.response_curves() , that sets the following arguments to be consistent with the budget optimization scenario specified in BudgetOptimizer.optimize() call that returned this result. In particular:

  1. spend_multiplier matches the discrete optimization grid, considering the grid step size and any channel-level constraint bounds.
  2. selected_times , by_reach , and use_optimal_frequency match the values set in BudgetOptimizer.optimize() .

Returns
A dataset returned by Analyzer.response_curves() , per budget optimization scenario specified in BudgetOptimizer.optimize() call that returned this result.

output_optimization_summary

View source

Generates and saves the HTML optimization summary output.

plot_budget_allocation

View source

Plots a pie chart showing the spend allocated for each channel.

Args

optimized
If True , shows the optimized spend. If False , shows the non-optimized spend.

Returns
An Altair pie chart showing the spend by channel.

plot_incremental_outcome_delta

View source

Plots a waterfall chart showing the change in incremental outcome.

plot_response_curves

View source

Plots the response curves, with spend constraints, for each channel.

Args

n_top_channels
Optional number of top channels by spend to include. By default, all channels are included.

Returns
An Altair plot showing the response curves with optimization details.

plot_spend_delta

View source

Plots a bar chart showing the optimized change in spend per channel.

__eq__

Return self==value.

Create a Mobile Website
View Site in Mobile | Classic
Share by: