meridian.analysis.optimizer.OptimizationResults

The optimized budget allocation.

This is a dataclass object containing datasets output from BudgetOptimizer.

The performance metrics (data variables) are: spend, percentage of spend, ROI, mROI, incremental outcome, CPIK, and effectiveness.

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 performance metrics to the optimized performance metrics.
spend_bounds The spend bounds used to scale the non-optimized performance metrics to the optimized performance metrics.
nonoptimized_data Performance metrics under the non-optimized budget. For R&F channels, the non-optimized frequency is used.
nonoptimized_data_with_optimal_freq Performance metrics under the non-optimized budget. For R&F channels, the optimal frequency is used if frequency was optimized.
optimized_data Performance metrics under the optimized budget. For R&F channels, the optimal frequency is used if frequency was optimized.
optimization_grid The grid information used for optimization.
new_data The optional DataTensors container that was used to create this budget allocation.
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.

new_data None