View source on GitHub
|
Spec dataclass for marketing budget optimization processor.
Inherits From: OptimizationSpec, DatedSpec
schema.processors.budget_optimization_processor.BudgetOptimizationSpec(
start_date: (datetime.date | None) = None,
end_date: (datetime.date | None) = None,
date_interval_tag: str = '',
*,
optimization_name: str,
grid_name: str,
group_id: (str | None) = None,
confidence_level: float = c.DEFAULT_CONFIDENCE_LEVEL,
scenario: (optimizer.FixedBudgetScenario | optimizer.FlexibleBudgetScenario) = dataclasses.field(default_factory=optimizer.FixedBudgetScenario),
constraints: Sequence[ChannelConstraint] = dataclasses.field(default_factory=list),
kpi_type: schema.processors.common.KpiType = schema.processors.budget_optimization_processor.BudgetOptimizationSpec.kpi_type,
grid: (optimizer.OptimizationGrid | None) = None,
include_response_curves: bool = True,
new_data: (analyzer.DataTensors | None) = None,
use_optimal_frequency: bool = True,
max_frequency: (float | None) = None
)
This spec is used both as user input to inform the budget optimization
processor of its constraints and parameters, as well as an output structure
that is serializable to a BudgetOptimizationSpec proto. The latter serves
as a metadata embedded in a BudgetOptimizationResult.
Attributes | |
|---|---|
objective
|
Always defined as KPI. |
scenario
|
The optimization scenario (whether fixed or flexible). |
constraints
|
Per-channel budget constraints. Defaults to relative
constraints [1, 2] for spend_constraint_lower and spend_constraint_upper
if not specified.
|
kpi_type
|
A common.KpiType enum denoting whether the optimized KPI is of a
'revenue' or 'non-revenue' type.
|
grid
|
The optimization grid to use for the optimization. If None, a new grid will be created within the optimizer. |
include_response_curves
|
Whether to include response curves in the output.
Setting this to False improves performance if only optimization result
is needed.
|
new_data
|
The new data to use for the optimization. If None, the training data will be used. |
use_optimal_frequency
|
Whether to use the optimal frequency. If set to
False, max_frequency is ignored.
|
max_frequency
|
The max frequency to use for the optimal frequency search
space. If not set when use_optimal_frequency is set to True, the max
frequency of the input data is used.
|
start_date
|
Dataclass field |
end_date
|
Dataclass field |
date_interval_tag
|
Dataclass field |
optimization_name
|
Dataclass field |
grid_name
|
Dataclass field |
group_id
|
Dataclass field |
confidence_level
|
Dataclass field |
Methods
resolver
resolver(
time_coordinates: tc.TimeCoordinates
) -> 'DatedSpecResolver'
Returns a date resolver for this spec, with the given Meridian model.
to_proto
to_proto() -> budget_pb.BudgetOptimizationSpec
validate
validate()
Check optimization parameters are valid.
__eq__
__eq__(
other
)
Return self==value.
View source on GitHub