google-meridian 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_meridian-1.1.0.dist-info → google_meridian-1.1.1.dist-info}/METADATA +2 -2
- google_meridian-1.1.1.dist-info/RECORD +41 -0
- {google_meridian-1.1.0.dist-info → google_meridian-1.1.1.dist-info}/WHEEL +1 -1
- meridian/__init__.py +2 -2
- meridian/analysis/__init__.py +1 -1
- meridian/analysis/analyzer.py +18 -17
- meridian/analysis/formatter.py +1 -1
- meridian/analysis/optimizer.py +1 -1
- meridian/analysis/summarizer.py +1 -1
- meridian/analysis/summary_text.py +1 -1
- meridian/analysis/test_utils.py +1 -1
- meridian/analysis/visualizer.py +2 -3
- meridian/constants.py +3 -3
- meridian/data/__init__.py +1 -1
- meridian/data/arg_builder.py +1 -1
- meridian/data/input_data.py +12 -8
- meridian/data/load.py +53 -40
- meridian/data/test_utils.py +60 -43
- meridian/data/time_coordinates.py +1 -1
- meridian/model/__init__.py +1 -1
- meridian/model/adstock_hill.py +1 -1
- meridian/model/knots.py +1 -1
- meridian/model/media.py +1 -1
- meridian/model/model.py +47 -27
- meridian/model/model_test_data.py +75 -1
- meridian/model/posterior_sampler.py +19 -15
- meridian/model/prior_distribution.py +1 -1
- meridian/model/prior_sampler.py +32 -26
- meridian/model/spec.py +1 -1
- meridian/model/transformers.py +1 -1
- google_meridian-1.1.0.dist-info/RECORD +0 -41
- {google_meridian-1.1.0.dist-info → google_meridian-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {google_meridian-1.1.0.dist-info → google_meridian-1.1.1.dist-info}/top_level.txt +0 -0
meridian/model/prior_sampler.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 The Meridian Authors.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -175,8 +175,9 @@ class PriorDistributionSampler:
|
|
|
175
175
|
(https://github.com/tensorflow/probability/blob/main/PRNGS.md).
|
|
176
176
|
|
|
177
177
|
Returns:
|
|
178
|
-
A mapping of RF parameter names to a tensor of shape
|
|
179
|
-
n_rf_channels]` or `[n_draws, n_rf_channels]`
|
|
178
|
+
A mapping of RF parameter names to a tensor of shape
|
|
179
|
+
`[n_draws, n_geos, n_rf_channels]` or `[n_draws, n_rf_channels]`
|
|
180
|
+
containing the samples.
|
|
180
181
|
"""
|
|
181
182
|
mmm = self._meridian
|
|
182
183
|
|
|
@@ -269,9 +270,9 @@ class PriorDistributionSampler:
|
|
|
269
270
|
(https://github.com/tensorflow/probability/blob/main/PRNGS.md).
|
|
270
271
|
|
|
271
272
|
Returns:
|
|
272
|
-
A mapping of organic media parameter names to a tensor of shape
|
|
273
|
-
n_geos, n_organic_media_channels] or
|
|
274
|
-
containing the samples.
|
|
273
|
+
A mapping of organic media parameter names to a tensor of shape
|
|
274
|
+
`[n_draws, n_geos, n_organic_media_channels]` or
|
|
275
|
+
`[n_draws, n_organic_media_channels]` containing the samples.
|
|
275
276
|
"""
|
|
276
277
|
mmm = self._meridian
|
|
277
278
|
|
|
@@ -352,9 +353,9 @@ class PriorDistributionSampler:
|
|
|
352
353
|
(https://github.com/tensorflow/probability/blob/main/PRNGS.md).
|
|
353
354
|
|
|
354
355
|
Returns:
|
|
355
|
-
A mapping of organic RF parameter names to a tensor of shape
|
|
356
|
-
n_geos, n_organic_rf_channels] or
|
|
357
|
-
containing the samples.
|
|
356
|
+
A mapping of organic RF parameter names to a tensor of shape
|
|
357
|
+
`[n_draws, n_geos, n_organic_rf_channels]` or
|
|
358
|
+
`[n_draws, n_organic_rf_channels]` containing the samples.
|
|
358
359
|
"""
|
|
359
360
|
mmm = self._meridian
|
|
360
361
|
|
|
@@ -436,9 +437,8 @@ class PriorDistributionSampler:
|
|
|
436
437
|
|
|
437
438
|
Returns:
|
|
438
439
|
A mapping of non-media treatment parameter names to a tensor of shape
|
|
439
|
-
[n_draws,
|
|
440
|
-
|
|
441
|
-
containing the samples.
|
|
440
|
+
`[n_draws, n_geos, n_non_media_channels]` or
|
|
441
|
+
`[n_draws, n_non_media_channels]` containing the samples.
|
|
442
442
|
"""
|
|
443
443
|
mmm = self._meridian
|
|
444
444
|
|
|
@@ -470,8 +470,7 @@ class PriorDistributionSampler:
|
|
|
470
470
|
mmm.compute_non_media_treatments_baseline()
|
|
471
471
|
)
|
|
472
472
|
linear_predictor_counterfactual_difference = (
|
|
473
|
-
mmm.non_media_treatments_normalized
|
|
474
|
-
- baseline_scaled
|
|
473
|
+
mmm.non_media_treatments_normalized - baseline_scaled
|
|
475
474
|
)
|
|
476
475
|
gamma_n_value = mmm.calculate_beta_x(
|
|
477
476
|
is_non_media=True,
|
|
@@ -517,8 +516,6 @@ class PriorDistributionSampler:
|
|
|
517
516
|
tau_g_excl_baseline = prior.tau_g_excl_baseline.sample(**sample_kwargs)
|
|
518
517
|
base_vars = {
|
|
519
518
|
constants.KNOT_VALUES: prior.knot_values.sample(**sample_kwargs),
|
|
520
|
-
constants.GAMMA_C: prior.gamma_c.sample(**sample_kwargs),
|
|
521
|
-
constants.XI_C: prior.xi_c.sample(**sample_kwargs),
|
|
522
519
|
constants.SIGMA: prior.sigma.sample(**sample_kwargs),
|
|
523
520
|
constants.TAU_G: (
|
|
524
521
|
_get_tau_g(
|
|
@@ -527,6 +524,7 @@ class PriorDistributionSampler:
|
|
|
527
524
|
).sample()
|
|
528
525
|
),
|
|
529
526
|
}
|
|
527
|
+
|
|
530
528
|
base_vars[constants.MU_T] = tfp.distributions.Deterministic(
|
|
531
529
|
tf.einsum(
|
|
532
530
|
"...k,kt->...t",
|
|
@@ -536,16 +534,24 @@ class PriorDistributionSampler:
|
|
|
536
534
|
name=constants.MU_T,
|
|
537
535
|
).sample()
|
|
538
536
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
537
|
+
# Omit gamma_c, xi_c, and gamma_gc parameters from sampled distributions if
|
|
538
|
+
# there are no control variables in the model.
|
|
539
|
+
if mmm.n_controls:
|
|
540
|
+
base_vars |= {
|
|
541
|
+
constants.GAMMA_C: prior.gamma_c.sample(**sample_kwargs),
|
|
542
|
+
constants.XI_C: prior.xi_c.sample(**sample_kwargs),
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
gamma_gc_dev = tfp.distributions.Sample(
|
|
546
|
+
tfp.distributions.Normal(0, 1),
|
|
547
|
+
[mmm.n_geos, mmm.n_controls],
|
|
548
|
+
name=constants.GAMMA_GC_DEV,
|
|
549
|
+
).sample(**sample_kwargs)
|
|
550
|
+
base_vars[constants.GAMMA_GC] = tfp.distributions.Deterministic(
|
|
551
|
+
base_vars[constants.GAMMA_C][..., tf.newaxis, :]
|
|
552
|
+
+ base_vars[constants.XI_C][..., tf.newaxis, :] * gamma_gc_dev,
|
|
553
|
+
name=constants.GAMMA_GC,
|
|
554
|
+
).sample()
|
|
549
555
|
|
|
550
556
|
media_vars = (
|
|
551
557
|
self._sample_media_priors(n_draws, seed)
|
meridian/model/spec.py
CHANGED
meridian/model/transformers.py
CHANGED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
google_meridian-1.1.0.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
2
|
-
meridian/__init__.py,sha256=Z2HBhx0G1hdGh8Q3k-4Bt6WrPHpHyAxUpeKaT0QXXQg,714
|
|
3
|
-
meridian/constants.py,sha256=C0Af-w-q4fL-GW08Z9jrRRCet-dAdXpz7LsX1SA8uf0,17157
|
|
4
|
-
meridian/analysis/__init__.py,sha256=-FooDZ5OzePpyTVkvRoWQx_xBaRR_hjVLny9H8-kkyQ,836
|
|
5
|
-
meridian/analysis/analyzer.py,sha256=qVv8654KLyz8kFVn06oHfkKfwXQHwS4RwdckTRbFpgE,203995
|
|
6
|
-
meridian/analysis/formatter.py,sha256=F8OYxD2bH13zV10JY63j2ugCOj-DpTXhyJr43n5ukr8,7270
|
|
7
|
-
meridian/analysis/optimizer.py,sha256=tYOqgj-neqgOGdjs6F4GbQVAmMQ9JyEUXpqUScanhnk,106122
|
|
8
|
-
meridian/analysis/summarizer.py,sha256=VVtMsNct5PrnWHdVnDzo_dyiTM9labUD55G1FXdxxOM,18855
|
|
9
|
-
meridian/analysis/summary_text.py,sha256=n6a-DTZxtS3WvdI_pDEK7lvO3MRUX3h83GzuVnG6sQ4,12438
|
|
10
|
-
meridian/analysis/test_utils.py,sha256=uNJuBsRaHz8Cnaqq5DhOc271mQKYk8h-fIG5du0kCBw,77699
|
|
11
|
-
meridian/analysis/visualizer.py,sha256=6iyNOtjds4CwPaTmEoh_2XuYx4kFxUl8W7t2fmL4vSk,93736
|
|
12
|
-
meridian/analysis/templates/card.html.jinja,sha256=pv4MVbQ25CcvtZY-LH7bFW0OSeHobkeEkAleB1sfQ14,1284
|
|
13
|
-
meridian/analysis/templates/chart.html.jinja,sha256=87i0xnXHRBoLLxBpKv2i960TLToWq4r1aVQZqaXIeMQ,1086
|
|
14
|
-
meridian/analysis/templates/chips.html.jinja,sha256=Az0tQwF_-b03JDLyOzpeH-8fb-6jgJgbNfnUUSm-q6E,645
|
|
15
|
-
meridian/analysis/templates/insights.html.jinja,sha256=6hEWipbOMiMzs9QGZ6dcB_73tNkj0ZtNiC8E89a98zg,606
|
|
16
|
-
meridian/analysis/templates/stats.html.jinja,sha256=9hQOG02FX1IHVIvdWS_-LI2bbSaqdyHEtCZkiArwAg0,772
|
|
17
|
-
meridian/analysis/templates/style.css,sha256=RODTWc2pXcG9zW3q9SEJpVXgeD-WwQgzLpmFcbXPhLg,5492
|
|
18
|
-
meridian/analysis/templates/style.scss,sha256=nSrZOpcIrVyiL4eC9jLUlxIZtAKZ0Rt8pwfk4H1nMrs,5076
|
|
19
|
-
meridian/analysis/templates/summary.html.jinja,sha256=LuENVDHYIpNo4pzloYaCR2K9XN1Ow6_9oQOcOwD9nGg,1707
|
|
20
|
-
meridian/analysis/templates/table.html.jinja,sha256=mvLMZx92RcD2JAS2w2eZtfYG-6WdfwYVo7pM8TbHp4g,1176
|
|
21
|
-
meridian/data/__init__.py,sha256=ixOYHDQExjnPTLLnZ758pRQscZP7c8QJqtc8P4hK-mE,774
|
|
22
|
-
meridian/data/arg_builder.py,sha256=f7LEysYmixAagwygZOEiJkRnWggRhTeXj5AXthBpkQ8,3741
|
|
23
|
-
meridian/data/input_data.py,sha256=GJcf3wqMrF1jFZ3hBk1mlqUMV8_-gEo8ZagiB5siJ58,39610
|
|
24
|
-
meridian/data/load.py,sha256=MKCnRoR8ZIfhEAcm5ZUQsjfoEzi1c9SDOgf6BR8Akr0,54642
|
|
25
|
-
meridian/data/test_utils.py,sha256=4c2WIPfu-vYudyVM9WLUWrJ4Op14L-zk34N09_6Za8E,55015
|
|
26
|
-
meridian/data/time_coordinates.py,sha256=wTr-JKWNkMOkiZQ8B16qy0bUUuMkdh9sI2-IP4HRUTw,9874
|
|
27
|
-
meridian/model/__init__.py,sha256=bvx8vvXolktsCTDKViU9U1v85pgNWF3haDowTKy11d4,982
|
|
28
|
-
meridian/model/adstock_hill.py,sha256=b_YYhqci6ndgi602FFXmx2f12ceC4N0tp338nMMtm54,9283
|
|
29
|
-
meridian/model/knots.py,sha256=r7PPaJM96d5pkoOeV9crIOgkM0-rh24mWMvypMiV4aQ,8054
|
|
30
|
-
meridian/model/media.py,sha256=Tb8tOK_ay1kGjq1a6xsjW8XdMOWAuYCgE7-YYSyJCho,13819
|
|
31
|
-
meridian/model/model.py,sha256=Vg0HZg8X5BiKLRgrM65xO4P6uO7S46BfTaP3qmjtUCI,60398
|
|
32
|
-
meridian/model/model_test_data.py,sha256=t6W-xRuQlrCuMOpdjy4zIzMdBCFuFbHB7_ELKqOI8L8,12917
|
|
33
|
-
meridian/model/posterior_sampler.py,sha256=S0ZbWFghiUV51yKt2tr4_aBr2JrqR5Z6wEXn8P8VmbI,27527
|
|
34
|
-
meridian/model/prior_distribution.py,sha256=vkvmZ0lIc150Fgejo7YVDzjWJxgs-tOPBlMneX5I1oo,42417
|
|
35
|
-
meridian/model/prior_sampler.py,sha256=xJ-X_Q1gFp6amANre78Cq70T1qS6UKO_iXmePNokX8g,23001
|
|
36
|
-
meridian/model/spec.py,sha256=lUGgSIAQdpBQIBNBPBTW5f9Dbk7PaxeLZVFuWQ1VZ00,17239
|
|
37
|
-
meridian/model/transformers.py,sha256=j6yHvLpdDGOXcJHddDP7pZalxMs25eGUx1vu2ppfriQ,7763
|
|
38
|
-
google_meridian-1.1.0.dist-info/METADATA,sha256=S4ADeuHKzmdSwL2GxVhwgeyr0DPpqJsM2m5xoi-R8XU,22055
|
|
39
|
-
google_meridian-1.1.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
40
|
-
google_meridian-1.1.0.dist-info/top_level.txt,sha256=nwaCebZvvU34EopTKZsjK0OMTFjVnkf4FfnBN_TAc0g,9
|
|
41
|
-
google_meridian-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|