validate_cost_per_target_rows#
- pymc_marketing.mmm.lift_test.validate_cost_per_target_rows(calibration_df, model, *, target_column='cost_per_target', get_indices=<function exact_row_indices>)[source]#
Check a cost-per-target table against model without touching the graph.
Shared by
add_cost_per_target_observations()andMMM.add_cost_per_target_calibrationso that a table is refused by one set of checks, before either of them changes the model.- Parameters:
calibration_df (
DataFrame) – One row per calibration value, with achannelcolumn, one column per non-date dim ofchannel_data, target_column andsigma.model (
Model) – The model whose coordinates the rows are mapped to.target_column (
str) – Column holding the calibration values.get_indices (
Callable[[DataFrame,Model],dict[str,Sequence[int] |ndarray[tuple[Any,...],dtype[integer]]]]) – Maps the dim columns of calibration_df to model coordinate indices.
- Return type:
tuple[Indices,np.ndarray,np.ndarray]- Returns:
The row indices per dim, the calibration values and their
sigmaas float arrays.- Raises:
KeyError – If a required column or dim column is missing.
UnalignedValuesError – If a
channelor dim label is not a model coordinate (with the default get_indices).ValueError – If target_column or
sigmacannot be converted to finite float values, or ifsigmais not strictly positive.