File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed
pymc_marketing/mmm/builders Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 1+ schema_version : 1
2+
3+ # ----------------------------------------------------------------------
4+ model :
5+ target : pymc_marketing.mmm.multidimensional.MMM
6+ kwargs :
7+ date_column : " date"
8+ channel_columns : # explicit for reproducibility
9+ - channel_1
10+ - channel_2
11+ # …
12+ target_column : " kpi_registrations"
13+
14+ # --- media transformations ---------------------------------------
15+ adstock :
16+ target : pymc_marketing.mmm.GeometricAdstock
17+ kwargs : {l_max: 12} # any other hyper-parameters here
18+
19+ saturation :
20+ target : pymc_marketing.mmm.MichaelisMentenSaturation
21+ kwargs : {} # default α, λ priors inside the class
22+
23+ # ----------------------------------------------------------------------
24+ # (optional) sampler options you plan to forward to pm.sample():
25+ sample_kwargs :
26+ tune : 1000
27+ draws : 200
28+ chains : 8
29+ random_seed : 42
30+ target_accept : 0.90
31+ nuts_sampler : " numpyro"
32+
33+ # ----------------------------------------------------------------------
34+ # (optional) idata from a previous sample
35+ # idata_path: "data/idata.nc"
36+
37+ # ----------------------------------------------------------------------
38+ # (optional) Data paths
39+ # data:
40+ # X_path: "data/X.csv"
41+ # y_path: "data/y.csv"
42+
43+ # ----------------------------------------------------------------------
44+ # (optional) Add original scale contribution variables
45+ # These will be processed after model building but before attaching idata
46+ original_scale_vars :
47+ - channel_contribution
48+ - intercept_contribution
Original file line number Diff line number Diff line change @@ -93,7 +93,12 @@ def build_from_yaml(
9393 # 4 ───────────────────────────────────────────── build PyMC graph
9494 model .build_model (X , y ) # this **must** precede any idata loading
9595
96- # 5 ──────────────────────────────────────────── attach inference data
96+ # 5 ───────────────────────── add original scale contribution variables
97+ original_scale_vars = cfg .get ("original_scale_vars" , [])
98+ if original_scale_vars :
99+ model .add_original_scale_contribution_variable (var = original_scale_vars )
100+
101+ # 6 ──────────────────────────────────────────── attach inference data
97102 if (idata_fp := cfg .get ("idata_path" )) is not None :
98103 idata_path = Path (idata_fp )
99104 if os .path .exists (idata_path ):
You can’t perform that action at this time.
0 commit comments