add_lift_measurements_to_likelihood_from_saturation#
- pymc_marketing.mmm.lift_test.add_lift_measurements_to_likelihood_from_saturation(df_lift_test, saturation, time_varying_var_name=None, model=None, dist=<class 'pymc.distributions.continuous.Gamma'>, name='lift_measurements', get_indices=<function exact_row_indices>, variable_indexer_factory=<function create_variable_indexer>)[source]#
Add lift measurements to the likelihood from a saturation transformation.
Wrapper around
add_saturation_observations()
to work with SaturationTransformation instances and time-varying variables.Used internally of the
MMM
class.- Parameters:
- df_lift_test
pd.DataFrame
- DataFrame with lift test results with at least the following columns:
x
: x axis value of the lift test.delta_x
: change in x axis value of the lift test.delta_y
: change in y axis value of the lift test.sigma
: standard deviation of the lift test.
- saturation
SaturationTransformation
Any SaturationTransformation instance.
- time_varying_var_name
str
, optional Name of the time-varying variable in model.
- model
Optional
[pm.Model
], optional PyMC model with arbitrary number of coordinates, by default None
- dist
pm.Distribution
class
, optional PyMC distribution to use for the likelihood, by default pm.Gamma
- name
str
, optional Name of the likelihood, by default “lift_measurements”
- get_indices
Callable
[[pd.DataFrame
,pm.Model
],Indices
], optional Function to get the indices of the DataFrame in the model, by default exact_row_indices which assumes that the columns map exactly to the model coordinates.
- variable_indexer_factory
Callable
[[pm.Model
,Indices
],Callable
[[str
],TensorVariable
]], optional Function to create a variable indexer, by default create_variable_indexer which creates a function to index variables in the model. This is used determine the values of the parameters to evaluate the saturation function.
- df_lift_test