View source on GitHub
|
Generates MarketingAnalysis protos for a given trained Meridian model.
Inherits From: ModelProcessor
schema.processors.marketing_processor.MarketingProcessor(
trained_model: model_processor.ModelType
)
A MarketingAnalysis proto is generated for each spec supplied to
execute(). Within each MarketingAnalysis proto, a MediaAnalysis proto
is created for each channel in the model. One NonMediaAnalysis proto is also
created for the model's baseline data.
Methods
execute
execute(
marketing_analysis_specs: Sequence[schema.processors.marketing_processor.MarketingAnalysisSpec]
) -> marketing_analysis_pb2.MarketingAnalysisList
Runs a marketing analysis on the model based on the given specs.
A MarketingAnalysis proto is created for each of the given specs. Each
MarketingAnalysis proto contains a list of MediaAnalysis protos and a
singleton NonMediaAnalysis proto for the baseline analysis. The analysis
covers the time period bounded by the spec's start and end dates.
The singleton non-media analysis is performed on the model's baseline data, and contains metrics such as incremental outcome and baseline percent of contribution across media and non-media.
A media analysis is performed for each channel in the model, plus an "All Channels" synthetic channel. The media analysis contains metrics such as spend, percent of spend, incremental outcome, percent of contribution, and effectiveness. Depending on the type of data (revenue-based or non-revenue-based) in the model, the analysis also contains CPIK (non-revenue-based) or ROI and MROI (revenue-based).
| Args | |
|---|---|
marketing_analysis_specs
|
A sequence of MarketingAnalysisSpec objects. |
| Returns | |
|---|---|
| A MarketingAnalysisList proto containing the results of the marketing analysis for each spec. |
output_type
@classmethodoutput_type() -> type[marketing_analysis_pb2.MarketingAnalysisList]
Returns the concrete output type that this ModelProcessor produces.
spec_type
@classmethodspec_type() -> type[MarketingAnalysisSpec]
Returns the concrete Spec type that this ModelProcessor operates on.
__call__
__call__(
specs: Sequence[S], output: pb.Mmm
)
Runs an analysis/optimization on the model using the given specs.
This also sets the appropriate output field in the given MmmOutput proto.
| Args | |
|---|---|
specs
|
Sequence of Specs containing parameters needed for the
analysis/optimization. The specs must all be of the same type as
self.spec_type() for this processor
|
output
|
The output proto to which the results of the analysis/optimization should be attached. |
| Raises | |
|---|---|
ValueError
|
If any spec is not of the same type as self.spec_type().
|
View source on GitHub