extract_response_distribution#
- pymc_marketing.pytensor_utils.extract_response_distribution(pymc_model, idata, response_variable, frozen_deterministics=None)[source]#
Extract the response distribution graph, conditioned on posterior parameters.
- Parameters:
- pymc_model
Model The PyMC model to extract the response distribution from.
- idata
InferenceData The inference data containing posterior samples.
- response_variable
str The name of the response variable to extract.
- frozen_deterministics
listofstr, optional Names of Deterministic variables to freeze at their posterior values instead of recomputing from the graph. Some models (e.g, those containing HSGP) need this to to obtain a valid conditional posterior graph.
- pymc_model
- Returns:
pt.TensorVariableThe response distribution graph.
Examples
extract_response_distribution(model, idata, "channel_contribution")returns a graph that computes"channel_contribution"as a function of both the newly introduced budgets and the posterior of model parameters.