Skip to main content
Version: Latest

reward_model

reward_model performs attribution from aggregated signals using a movement/coherence-based reward baseline. It uses the same tabular D_variables structure as auto_mmm.

At a high level, auto_mmm estimates predictive contribution with the automatic MMM engine, while reward_model estimates contribution from directional movement coherence between signals and the target.

Input structure

Data should contain:

  • a timestamp column
  • one target column, passed separately through the target parameter
  • one or more signal columns used as attribution inputs

D_variables should be a table/data frame with one row per non-target signal variable and these columns:

COLUMNDESCRIPTION
variableName of the signal column in Data.
channelFinal attribution channel associated with the signal. Multiple variables can map to the same channel.
measureMeasure type for the signal, such as impressions, clicks, cost, direct_searches, platform_signal, or another supported measure label.

The old D_measures parameter is no longer used. Measure information must be provided inside D_variables.

Example D_variables structure:

variable              channel       measure
direct_searches direct direct_searches
facebook_impressions facebook_ads impressions
facebook_cost facebook_ads cost
google_impressions google_ads impressions
google_clicks google_ads clicks
google_cost google_ads cost

Parameters

PARAMETERTYPEDEFAULTDESCRIPTION
Datadata.frameAggregated dataset with timestamp, target, and input signal columns.
D_variablesdata.frame / tableTable with variable, channel, and measure columns.
targetstr"conversions"Name of the target column in Data.
max_pint12Maximum lag length considered when the model evaluates delayed effects.
seedint1234567Random seed for reproducible results.
verboseint / bool1Controls runtime logging.
serverstr / list[str]app.channelattribution.ioServer endpoint used by the hosted computation service.
passwordstrNULL / NoneAuthentication token for the hosted service.
return_diagnosticsboolFALSE / FalseIf enabled, returns attribution together with diagnostic objects for advanced inspection.

Scoring summary

For each channel and lag, reward_model evaluates directional coherence between the lagged signal and the target. The lag score uses the number of non-zero observations used for the lag as a reliability factor:

score_lag = n0 / (n0 + 10) * coherence_rate

where n0 is the number of non-zero observations used to evaluate the current lag. The selected channel score is then converted into a score_multiplier through the shared median/blend scoring logic.

Output

If return_diagnostics = FALSE, the function returns an attribution data frame.

If return_diagnostics = TRUE, the function returns a list/dict containing:

OUTPUTTYPEDESCRIPTION
attributiondata.frameChannel attribution by time period.
base_rawdata.frame / objectRaw baseline attribution output before final adjustments.
score_multiplierdict / objectScore multiplier information used during attribution assembly.
applied_score_multiplierdict / objectEffective multiplier applied to the returned attribution.
individual_scoresdict / objectChannel-level movement/coherence scores selected from the lag evaluation.
modestrExecution mode metadata.
diagnosticslist / dictAdditional diagnostics intended for advanced inspection.