View source on GitHub
|
Spec dataclass for marketing reach and frequency optimization processor.
Inherits From: OptimizationSpec, DatedSpec
schema.processors.reach_frequency_optimization_processor.ReachFrequencyOptimizationSpec(
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,
min_frequency: float = 1.0,
max_frequency: (float | None) = None,
rf_channels: Sequence[str] = dataclasses.field(default_factory=list),
kpi_type: schema.processors.common.KpiType = schema.processors.budget_optimization_processor.BudgetOptimizationSpec.kpi_type
)
A frequency grid is generated using the range [rounded_min_frequency,
rounded_max_frequency] and a step size of STEP_SIZE=0.1.
rounded_min_frequency and rounded_max_frequency are rounded to the
nearest multiple of STEP_SIZE.
This spec is used both as user input to inform the R&F optimization processor
of its constraints and parameters, as well as an output structure that is
serializable to a ReachFrequencyOptimizationSpec proto. The latter serves as
a metadata embedded in a ReachFrequencyOptimizationResult. The output spec
in the proto reflects the actual numbers used to generate the reach and
frequency optimization result.
Attributes | |
|---|---|
min_frequency
|
The minimum frequency constraint for each channel. Must be
greater than or equal to 1.0. Defaults to 1.0.
|
max_frequency
|
The maximum frequency constraint for each channel. Must be greater than min_frequency. Defaults to None. If this value is set to None, the model's max frequency will be used. |
rf_channels
|
The R&F media channels in the model. When resolved with a model, the model's R&F channels will be present here. Ignored when used as input. |
kpi_type
|
A common.KpiType enum denoting whether the optimized KPI is of a
'revenue' or 'non-revenue' type.
|
objective
|
A Meridian budget optimization objective is always ROI. |
selected_times
|
The start and end dates, as a tuple of date strings. |
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() -> rf_pb.ReachFrequencyOptimizationSpec
validate
validate()
Check optimization parameters are valid.
__eq__
__eq__(
other
)
Return self==value.
Class Variables | |
|---|---|
| confidence_level |
0.9
|
| date_interval_tag |
''
|
| end_date |
None
|
| group_id |
None
|
| kpi_type |
<KpiType.REVENUE: 2>
|
| max_frequency |
None
|
| min_frequency |
1.0
|
| start_date |
None
|
View source on GitHub