parse_model_config#
- pymc_marketing.model_config.parse_model_config(model_config, hsgp_kwargs_fields=None, **kwargs)[source]#
Parse the model config dictionary.
- Parameters:
- Returns:
dictThe parsed model configuration dictionary.
- Raises:
ModelConfigErrorIf an entry looks like a legacy dict-format prior spec, if an
hsgp_kwargs_fieldsentry failsHSGPKwargsvalidation, or if a parameter removed in v1.0.0 is passed.
Examples
Parse the HSGP kwargs field in a model configuration.
from pymc_marketing.hsgp_kwargs import HSGPKwargs from pymc_marketing.model_config import parse_model_config from pymc_extras.prior import Prior model_config = { "alpha": Prior("Normal", mu=0, sigma=1), "beta": Prior("HalfNormal"), "intercept_tvp_config": { "m": 200, "L": 119.17, "eta_lam": 1.0, "ls_mu": 5.0, "ls_sigma": 10.0, "cov_func": None, }, "other_intercept": { "key": "Some other non-distribution configuration", }, } parsed_model_config = parse_model_config( model_config, hsgp_kwargs_fields=["intercept_tvp_config"], ) # {'alpha': Prior("Normal", mu=0, sigma=1), # unchanged # 'beta': Prior("HalfNormal"), # unchanged # 'intercept_tvp_config': HSGPKwargs(m=200, L=119.17, eta_lam=1.0, ls_mu=5.0, ls_sigma=10.0, cov_func=None), # 'other_intercept': {'key': 'Some other non-distribution configuration'}}