View source on GitHub
|
The optimized budget allocation.
meridian.analysis.optimizer.OptimizationResults(
meridian: model.Meridian,
analyzer: meridian.analysis.analyzer.Analyzer,
spend_ratio: np.ndarray,
spend_bounds: tuple[np.ndarray, np.ndarray],
_nonoptimized_data: xr.Dataset,
_nonoptimized_data_with_optimal_freq: xr.Dataset,
_optimized_data: xr.Dataset,
_optimization_grid: meridian.analysis.optimizer.OptimizationGrid,
new_data: (meridian.analysis.analyzer.DataTensors | None) = None
)
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.
Methods
get_response_curves
get_response_curves() -> xr.Dataset
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:
spend_multipliermatches the discrete optimization grid, considering the grid step size and any channel-level constraint bounds.selected_times,by_reach, anduse_optimal_frequencymatch the values set inBudgetOptimizer.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
output_optimization_summary(
filename: str, filepath: str, currency: str = c.DEFAULT_CURRENCY
)
Generates and saves the HTML optimization summary output.
plot_budget_allocation
plot_budget_allocation(
optimized: bool = True
) -> alt.Chart
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
plot_incremental_outcome_delta(
*, is_vertical: bool = True
) -> alt.Chart
Plots a waterfall chart showing the change in incremental outcome.
| Args | |
|---|---|
is_vertical
|
If True, the plot has a vertical orientation. If False,
it has a horizontal orientation. Defaults to True.
|
| Returns | |
|---|---|
| An Altair chart object representing the waterfall chart of incremental outcome changes. |
plot_response_curves
plot_response_curves(
n_top_channels: (int | None) = None
) -> alt.Chart
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
plot_spend_delta(
currency: str = c.DEFAULT_CURRENCY, *, is_vertical: bool = True
) -> alt.Chart
Plots a bar chart showing the optimized change in spend per channel.
| Args | |
|---|---|
currency
|
The currency symbol to use for the quantitative axis. |
is_vertical
|
If True, the plot has a vertical orientation. If False,
it has a horizontal orientation. Defaults to True.
|
| Returns | |
|---|---|
| An Altair bar chart showing the optimized change in spend per channel. |
__eq__
__eq__(
other
)
Return self==value.
Class Variables | |
|---|---|
| new_data |
None
|
View source on GitHub