google-meridian 1.2.1__py3-none-any.whl → 1.3.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.3.1.dist-info/METADATA +209 -0
- google_meridian-1.3.1.dist-info/RECORD +76 -0
- {google_meridian-1.2.1.dist-info → google_meridian-1.3.1.dist-info}/top_level.txt +1 -0
- meridian/analysis/__init__.py +2 -0
- meridian/analysis/analyzer.py +179 -105
- meridian/analysis/formatter.py +2 -2
- meridian/analysis/optimizer.py +227 -87
- meridian/analysis/review/__init__.py +20 -0
- meridian/analysis/review/checks.py +721 -0
- meridian/analysis/review/configs.py +110 -0
- meridian/analysis/review/constants.py +40 -0
- meridian/analysis/review/results.py +544 -0
- meridian/analysis/review/reviewer.py +186 -0
- meridian/analysis/summarizer.py +21 -34
- meridian/analysis/templates/chips.html.jinja +12 -0
- meridian/analysis/test_utils.py +27 -5
- meridian/analysis/visualizer.py +41 -57
- meridian/backend/__init__.py +457 -118
- meridian/backend/test_utils.py +162 -0
- meridian/constants.py +39 -3
- meridian/model/__init__.py +1 -0
- meridian/model/eda/__init__.py +3 -0
- meridian/model/eda/constants.py +21 -0
- meridian/model/eda/eda_engine.py +1309 -196
- meridian/model/eda/eda_outcome.py +200 -0
- meridian/model/eda/eda_spec.py +84 -0
- meridian/model/eda/meridian_eda.py +220 -0
- meridian/model/knots.py +55 -49
- meridian/model/media.py +10 -8
- meridian/model/model.py +79 -16
- meridian/model/model_test_data.py +53 -0
- meridian/model/posterior_sampler.py +39 -32
- meridian/model/prior_distribution.py +12 -2
- meridian/model/prior_sampler.py +146 -90
- meridian/model/spec.py +7 -8
- meridian/model/transformers.py +11 -3
- meridian/version.py +1 -1
- schema/__init__.py +18 -0
- schema/serde/__init__.py +26 -0
- schema/serde/constants.py +48 -0
- schema/serde/distribution.py +515 -0
- schema/serde/eda_spec.py +192 -0
- schema/serde/function_registry.py +143 -0
- schema/serde/hyperparameters.py +363 -0
- schema/serde/inference_data.py +105 -0
- schema/serde/marketing_data.py +1321 -0
- schema/serde/meridian_serde.py +413 -0
- schema/serde/serde.py +47 -0
- schema/serde/test_data.py +4608 -0
- schema/utils/__init__.py +17 -0
- schema/utils/time_record.py +156 -0
- google_meridian-1.2.1.dist-info/METADATA +0 -409
- google_meridian-1.2.1.dist-info/RECORD +0 -52
- {google_meridian-1.2.1.dist-info → google_meridian-1.3.1.dist-info}/WHEEL +0 -0
- {google_meridian-1.2.1.dist-info → google_meridian-1.3.1.dist-info}/licenses/LICENSE +0 -0
schema/utils/__init__.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 The Meridian Authors.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Module containing MMM schema util functions."""
|
|
16
|
+
|
|
17
|
+
from schema.utils import time_record
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Copyright 2025 The Meridian Authors.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Helper functions for time-related operations."""
|
|
16
|
+
|
|
17
|
+
from collections.abc import Mapping, MutableMapping, Sequence
|
|
18
|
+
import datetime
|
|
19
|
+
|
|
20
|
+
from meridian import constants
|
|
21
|
+
from mmm.v1.common import date_interval_pb2
|
|
22
|
+
import pandas as pd
|
|
23
|
+
|
|
24
|
+
from google.type import date_pb2
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"convert_times_to_date_intervals",
|
|
29
|
+
"create_date_interval_pb",
|
|
30
|
+
"dates_from_date_interval_proto",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def convert_times_to_date_intervals(
|
|
35
|
+
times: Sequence[str] | Sequence[datetime.date] | pd.DatetimeIndex,
|
|
36
|
+
) -> Mapping[str, date_interval_pb2.DateInterval]:
|
|
37
|
+
"""Creates a date interval for each time in `times` as dict values.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
times: Sequence of date strings in YYYY-MM-DD format.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
Mapping that maps each time in `times` (string form) to the corresponding
|
|
44
|
+
date interval.
|
|
45
|
+
|
|
46
|
+
Raises:
|
|
47
|
+
ValueError: If `times` has fewer than 2 elements or if the interval length
|
|
48
|
+
between each time is not consistent.
|
|
49
|
+
"""
|
|
50
|
+
if len(times) < 2:
|
|
51
|
+
raise ValueError("There must be at least 2 time points.")
|
|
52
|
+
|
|
53
|
+
if isinstance(times, pd.DatetimeIndex):
|
|
54
|
+
datetimes = [
|
|
55
|
+
datetime.datetime(year=time.year, month=time.month, day=time.day)
|
|
56
|
+
for time in times
|
|
57
|
+
]
|
|
58
|
+
else:
|
|
59
|
+
datetimes = [
|
|
60
|
+
datetime.datetime.strptime(time, constants.DATE_FORMAT)
|
|
61
|
+
if isinstance(time, str)
|
|
62
|
+
else time
|
|
63
|
+
for time in times
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
interval_length = _compute_interval_length(
|
|
67
|
+
start_date=datetimes[0],
|
|
68
|
+
end_date=datetimes[1],
|
|
69
|
+
)
|
|
70
|
+
time_to_date_interval: MutableMapping[str, date_interval_pb2.DateInterval] = (
|
|
71
|
+
{}
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
for i, start_date in enumerate(datetimes):
|
|
75
|
+
if i == len(datetimes) - 1:
|
|
76
|
+
end_date = start_date + datetime.timedelta(days=interval_length)
|
|
77
|
+
else:
|
|
78
|
+
end_date = datetimes[i + 1]
|
|
79
|
+
current_interval_length = _compute_interval_length(
|
|
80
|
+
start_date=start_date,
|
|
81
|
+
end_date=end_date,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
if current_interval_length != interval_length:
|
|
85
|
+
raise ValueError(
|
|
86
|
+
"Interval length between selected times must be consistent."
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
date_interval = create_date_interval_pb(start_date, end_date)
|
|
90
|
+
time_to_date_interval[start_date.strftime(constants.DATE_FORMAT)] = (
|
|
91
|
+
date_interval
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return time_to_date_interval
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def create_date_interval_pb(
|
|
98
|
+
start_date: datetime.date, end_date: datetime.date, tag: str = ""
|
|
99
|
+
) -> date_interval_pb2.DateInterval:
|
|
100
|
+
"""Creates a `DateInterval` proto for the given start and end dates.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
start_date: A datetime object representing the start date.
|
|
104
|
+
end_date: A datetime object representing the end date.
|
|
105
|
+
tag: An optional tag to identify the date interval.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Returns a date interval proto wrapping the start/end dates.
|
|
109
|
+
"""
|
|
110
|
+
start_date_proto = date_pb2.Date(
|
|
111
|
+
year=start_date.year,
|
|
112
|
+
month=start_date.month,
|
|
113
|
+
day=start_date.day,
|
|
114
|
+
)
|
|
115
|
+
end_date_proto = date_pb2.Date(
|
|
116
|
+
year=end_date.year,
|
|
117
|
+
month=end_date.month,
|
|
118
|
+
day=end_date.day,
|
|
119
|
+
)
|
|
120
|
+
return date_interval_pb2.DateInterval(
|
|
121
|
+
start_date=start_date_proto,
|
|
122
|
+
end_date=end_date_proto,
|
|
123
|
+
tag=tag,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def dates_from_date_interval_proto(
|
|
128
|
+
date_interval: date_interval_pb2.DateInterval,
|
|
129
|
+
) -> tuple[datetime.date, datetime.date]:
|
|
130
|
+
"""Returns a tuple of `[start, end)` date range from a `DateInterval` proto."""
|
|
131
|
+
start_date = datetime.date(
|
|
132
|
+
date_interval.start_date.year,
|
|
133
|
+
date_interval.start_date.month,
|
|
134
|
+
date_interval.start_date.day,
|
|
135
|
+
)
|
|
136
|
+
end_date = datetime.date(
|
|
137
|
+
date_interval.end_date.year,
|
|
138
|
+
date_interval.end_date.month,
|
|
139
|
+
date_interval.end_date.day,
|
|
140
|
+
)
|
|
141
|
+
return start_date, end_date
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _compute_interval_length(
|
|
145
|
+
start_date: datetime.datetime, end_date: datetime.datetime
|
|
146
|
+
) -> int:
|
|
147
|
+
"""Computes the number of days between `start_date` and `end_date`.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
start_date: A datetime object representing the start date.
|
|
151
|
+
end_date: A datetime object representing the end date.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
The number of days between the given dates.
|
|
155
|
+
"""
|
|
156
|
+
return end_date.toordinal() - start_date.toordinal()
|
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: google-meridian
|
|
3
|
-
Version: 1.2.1
|
|
4
|
-
Summary: Google's open source mixed marketing model library, helps you understand your return on investment and direct your ad spend with confidence.
|
|
5
|
-
Author-email: The Meridian Authors <no-reply@google.com>
|
|
6
|
-
License:
|
|
7
|
-
Apache License
|
|
8
|
-
Version 2.0, January 2004
|
|
9
|
-
http://www.apache.org/licenses/
|
|
10
|
-
|
|
11
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
12
|
-
|
|
13
|
-
1. Definitions.
|
|
14
|
-
|
|
15
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
16
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
17
|
-
|
|
18
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
19
|
-
the copyright owner that is granting the License.
|
|
20
|
-
|
|
21
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
22
|
-
other entities that control, are controlled by, or are under common
|
|
23
|
-
control with that entity. For the purposes of this definition,
|
|
24
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
25
|
-
direction or management of such entity, whether by contract or
|
|
26
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
27
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
28
|
-
|
|
29
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
30
|
-
exercising permissions granted by this License.
|
|
31
|
-
|
|
32
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
33
|
-
including but not limited to software source code, documentation
|
|
34
|
-
source, and configuration files.
|
|
35
|
-
|
|
36
|
-
"Object" form shall mean any form resulting from mechanical
|
|
37
|
-
transformation or translation of a Source form, including but
|
|
38
|
-
not limited to compiled object code, generated documentation,
|
|
39
|
-
and conversions to other media types.
|
|
40
|
-
|
|
41
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
42
|
-
Object form, made available under the License, as indicated by a
|
|
43
|
-
copyright notice that is included in or attached to the work
|
|
44
|
-
(an example is provided in the Appendix below).
|
|
45
|
-
|
|
46
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
47
|
-
form, that is based on (or derived from) the Work and for which the
|
|
48
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
49
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
50
|
-
of this License, Derivative Works shall not include works that remain
|
|
51
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
52
|
-
the Work and Derivative Works thereof.
|
|
53
|
-
|
|
54
|
-
"Contribution" shall mean any work of authorship, including
|
|
55
|
-
the original version of the Work and any modifications or additions
|
|
56
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
57
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
58
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
59
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
60
|
-
means any form of electronic, verbal, or written communication sent
|
|
61
|
-
to the Licensor or its representatives, including but not limited to
|
|
62
|
-
communication on electronic mailing lists, source code control systems,
|
|
63
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
64
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
65
|
-
excluding communication that is conspicuously marked or otherwise
|
|
66
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
67
|
-
|
|
68
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
69
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
70
|
-
subsequently incorporated within the Work.
|
|
71
|
-
|
|
72
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
73
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
76
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
77
|
-
Work and such Derivative Works in Source or Object form.
|
|
78
|
-
|
|
79
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
80
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
81
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
82
|
-
(except as stated in this section) patent license to make, have made,
|
|
83
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
84
|
-
where such license applies only to those patent claims licensable
|
|
85
|
-
by such Contributor that are necessarily infringed by their
|
|
86
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
87
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
88
|
-
institute patent litigation against any entity (including a
|
|
89
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
90
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
91
|
-
or contributory patent infringement, then any patent licenses
|
|
92
|
-
granted to You under this License for that Work shall terminate
|
|
93
|
-
as of the date such litigation is filed.
|
|
94
|
-
|
|
95
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
96
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
97
|
-
modifications, and in Source or Object form, provided that You
|
|
98
|
-
meet the following conditions:
|
|
99
|
-
|
|
100
|
-
(a) You must give any other recipients of the Work or
|
|
101
|
-
Derivative Works a copy of this License; and
|
|
102
|
-
|
|
103
|
-
(b) You must cause any modified files to carry prominent notices
|
|
104
|
-
stating that You changed the files; and
|
|
105
|
-
|
|
106
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
107
|
-
that You distribute, all copyright, patent, trademark, and
|
|
108
|
-
attribution notices from the Source form of the Work,
|
|
109
|
-
excluding those notices that do not pertain to any part of
|
|
110
|
-
the Derivative Works; and
|
|
111
|
-
|
|
112
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
113
|
-
distribution, then any Derivative Works that You distribute must
|
|
114
|
-
include a readable copy of the attribution notices contained
|
|
115
|
-
within such NOTICE file, excluding those notices that do not
|
|
116
|
-
pertain to any part of the Derivative Works, in at least one
|
|
117
|
-
of the following places: within a NOTICE text file distributed
|
|
118
|
-
as part of the Derivative Works; within the Source form or
|
|
119
|
-
documentation, if provided along with the Derivative Works; or,
|
|
120
|
-
within a display generated by the Derivative Works, if and
|
|
121
|
-
wherever such third-party notices normally appear. The contents
|
|
122
|
-
of the NOTICE file are for informational purposes only and
|
|
123
|
-
do not modify the License. You may add Your own attribution
|
|
124
|
-
notices within Derivative Works that You distribute, alongside
|
|
125
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
126
|
-
that such additional attribution notices cannot be construed
|
|
127
|
-
as modifying the License.
|
|
128
|
-
|
|
129
|
-
You may add Your own copyright statement to Your modifications and
|
|
130
|
-
may provide additional or different license terms and conditions
|
|
131
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
132
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
133
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
134
|
-
the conditions stated in this License.
|
|
135
|
-
|
|
136
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
137
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
138
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
139
|
-
this License, without any additional terms or conditions.
|
|
140
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
141
|
-
the terms of any separate license agreement you may have executed
|
|
142
|
-
with Licensor regarding such Contributions.
|
|
143
|
-
|
|
144
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
145
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
146
|
-
except as required for reasonable and customary use in describing the
|
|
147
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
148
|
-
|
|
149
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
150
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
151
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
152
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
153
|
-
implied, including, without limitation, any warranties or conditions
|
|
154
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
155
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
156
|
-
appropriateness of using or redistributing the Work and assume any
|
|
157
|
-
risks associated with Your exercise of permissions under this License.
|
|
158
|
-
|
|
159
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
160
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
161
|
-
unless required by applicable law (such as deliberate and grossly
|
|
162
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
163
|
-
liable to You for damages, including any direct, indirect, special,
|
|
164
|
-
incidental, or consequential damages of any character arising as a
|
|
165
|
-
result of this License or out of the use or inability to use the
|
|
166
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
167
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
168
|
-
other commercial damages or losses), even if such Contributor
|
|
169
|
-
has been advised of the possibility of such damages.
|
|
170
|
-
|
|
171
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
172
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
173
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
174
|
-
or other liability obligations and/or rights consistent with this
|
|
175
|
-
License. However, in accepting such obligations, You may act only
|
|
176
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
177
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
178
|
-
defend, and hold each Contributor harmless for any liability
|
|
179
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
180
|
-
of your accepting any such warranty or additional liability.
|
|
181
|
-
|
|
182
|
-
END OF TERMS AND CONDITIONS
|
|
183
|
-
|
|
184
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
185
|
-
|
|
186
|
-
To apply the Apache License to your work, attach the following
|
|
187
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
188
|
-
replaced with your own identifying information. (Don't include
|
|
189
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
190
|
-
comment syntax for the file format. We also recommend that a
|
|
191
|
-
file or class name and description of purpose be included on the
|
|
192
|
-
same "printed page" as the copyright notice for easier
|
|
193
|
-
identification within third-party archives.
|
|
194
|
-
|
|
195
|
-
Copyright [yyyy] [name of copyright owner]
|
|
196
|
-
|
|
197
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
198
|
-
you may not use this file except in compliance with the License.
|
|
199
|
-
You may obtain a copy of the License at
|
|
200
|
-
|
|
201
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
202
|
-
|
|
203
|
-
Unless required by applicable law or agreed to in writing, software
|
|
204
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
205
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
206
|
-
See the License for the specific language governing permissions and
|
|
207
|
-
limitations under the License.
|
|
208
|
-
Project-URL: homepage, https://github.com/google/meridian
|
|
209
|
-
Project-URL: repository, https://github.com/google/meridian
|
|
210
|
-
Project-URL: changelog, https://github.com/google/meridian/blob/main/CHANGELOG.md
|
|
211
|
-
Project-URL: documentation, https://developers.google.com/meridian
|
|
212
|
-
Keywords: mmm
|
|
213
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
214
|
-
Classifier: Programming Language :: Python :: 3
|
|
215
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
216
|
-
Classifier: Topic :: Other/Nonlisted Topic
|
|
217
|
-
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
218
|
-
Requires-Python: >=3.10
|
|
219
|
-
Description-Content-Type: text/markdown
|
|
220
|
-
License-File: LICENSE
|
|
221
|
-
Requires-Dist: arviz
|
|
222
|
-
Requires-Dist: altair>=5
|
|
223
|
-
Requires-Dist: immutabledict
|
|
224
|
-
Requires-Dist: joblib
|
|
225
|
-
Requires-Dist: natsort<8,>=7.1.1
|
|
226
|
-
Requires-Dist: numpy<3,>=2.0.2
|
|
227
|
-
Requires-Dist: pandas<3,>=2.2.2
|
|
228
|
-
Requires-Dist: patsy<0.5.4,>=0.5.3
|
|
229
|
-
Requires-Dist: scipy<2,>=1.13.1
|
|
230
|
-
Requires-Dist: statsmodels>=0.12.2
|
|
231
|
-
Requires-Dist: tensorflow<2.19,>=2.18
|
|
232
|
-
Requires-Dist: tensorflow-probability<0.26,>=0.25
|
|
233
|
-
Requires-Dist: tf-keras<2.19,>=2.18
|
|
234
|
-
Requires-Dist: xarray
|
|
235
|
-
Provides-Extra: dev
|
|
236
|
-
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
237
|
-
Requires-Dist: pytest-xdist; extra == "dev"
|
|
238
|
-
Requires-Dist: pylint>=2.6.0; extra == "dev"
|
|
239
|
-
Requires-Dist: pyink; extra == "dev"
|
|
240
|
-
Provides-Extra: colab
|
|
241
|
-
Requires-Dist: psutil; extra == "colab"
|
|
242
|
-
Requires-Dist: python-calamine; extra == "colab"
|
|
243
|
-
Provides-Extra: and-cuda
|
|
244
|
-
Requires-Dist: tensorflow[and-cuda]<2.19,>=2.18; extra == "and-cuda"
|
|
245
|
-
Provides-Extra: mlflow
|
|
246
|
-
Requires-Dist: mlflow; extra == "mlflow"
|
|
247
|
-
Provides-Extra: jax
|
|
248
|
-
Requires-Dist: jax==0.4.26; extra == "jax"
|
|
249
|
-
Requires-Dist: jaxlib==0.4.26; extra == "jax"
|
|
250
|
-
Requires-Dist: tensorflow-probability[substrates-jax]<0.26,>=0.25; extra == "jax"
|
|
251
|
-
Dynamic: license-file
|
|
252
|
-
|
|
253
|
-
# About Meridian
|
|
254
|
-
|
|
255
|
-
Marketing mix modeling (MMM) is a statistical analysis technique that measures
|
|
256
|
-
the impact of marketing campaigns and activities to guide budget planning
|
|
257
|
-
decisions and improve overall media effectiveness. MMM uses aggregated data to
|
|
258
|
-
measure impact across marketing channels and account for non-marketing factors
|
|
259
|
-
that impact sales and other key performance indicators (KPIs). MMM is
|
|
260
|
-
privacy-safe and does not use any cookie or user-level information.
|
|
261
|
-
|
|
262
|
-
Meridian is an MMM framework that enables advertisers to set up and run their
|
|
263
|
-
own in-house models. Meridian helps you answer key questions such as:
|
|
264
|
-
|
|
265
|
-
* How did the marketing channels drive my revenue or other KPI?
|
|
266
|
-
* What was my marketing return on investment (ROI)?
|
|
267
|
-
* How do I optimize my marketing budget allocation for the future?
|
|
268
|
-
|
|
269
|
-
Meridian is a highly customizable modeling framework that is based on
|
|
270
|
-
[Bayesian causal inference](https://developers.google.com/meridian/docs/basics/bayesian-inference).
|
|
271
|
-
It is capable of handling large scale geo-level data, which is encouraged if
|
|
272
|
-
available, but it can also be used for national-level modeling. Meridian
|
|
273
|
-
provides clear insights and visualizations to inform business decisions around
|
|
274
|
-
marketing budget and planning. Additionally, Meridian provides methodologies to
|
|
275
|
-
support calibration of MMM with experiments and other prior information, and to
|
|
276
|
-
optimize target ad frequency by utilizing reach and frequency data.
|
|
277
|
-
|
|
278
|
-
If you are using LightweightMMM, see the
|
|
279
|
-
[migration guide](https://developers.google.com/meridian/docs/migrate) to help
|
|
280
|
-
you understand the differences between these MMM projects.
|
|
281
|
-
|
|
282
|
-
## Install Meridian
|
|
283
|
-
|
|
284
|
-
Python 3.11 or 3.12 is required to use Meridian. We also recommend using a
|
|
285
|
-
minimum of 1 GPU.
|
|
286
|
-
|
|
287
|
-
Note: This project has been tested on T4 GPU using 16 GB of RAM.
|
|
288
|
-
|
|
289
|
-
To install Meridian, run the following command to automatically install the
|
|
290
|
-
latest release from PyPI.
|
|
291
|
-
|
|
292
|
-
* For Linux-GPU users:
|
|
293
|
-
|
|
294
|
-
Note: CUDA toolchain and a compatible GPU device is necessary for
|
|
295
|
-
`[and-cuda]` extra to activate.
|
|
296
|
-
|
|
297
|
-
```sh
|
|
298
|
-
$ pip install --upgrade google-meridian[and-cuda]
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
* For macOS and general CPU users:
|
|
302
|
-
|
|
303
|
-
Note: There is no official GPU support for macOS.
|
|
304
|
-
|
|
305
|
-
```sh
|
|
306
|
-
$ pip install --upgrade google-meridian
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
Alternatively, run the following command to install the most recent, unreleased
|
|
310
|
-
version from GitHub.
|
|
311
|
-
|
|
312
|
-
* For GPU users:
|
|
313
|
-
|
|
314
|
-
```sh
|
|
315
|
-
$ pip install --upgrade "google-meridian[and-cuda] @ git+https://github.com/google/meridian.git"
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
* For CPU users:
|
|
319
|
-
|
|
320
|
-
```sh
|
|
321
|
-
$ pip install --upgrade git+https://github.com/google/meridian.git
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
We recommend to install Meridian in a fresh
|
|
325
|
-
[virtual environment](https://virtualenv.pypa.io/en/latest/user_guide.html#quick-start)
|
|
326
|
-
to make sure that correct versions of all the dependencies are installed, as
|
|
327
|
-
defined in [pyproject.toml](https://github.com/google/meridian/blob/main/pyproject.toml).
|
|
328
|
-
|
|
329
|
-
## How to use the Meridian library
|
|
330
|
-
|
|
331
|
-
To get started with Meridian, you can run the code programmatically using sample
|
|
332
|
-
data with the [Getting Started Colab][3].
|
|
333
|
-
|
|
334
|
-
The Meridian model uses a holistic MCMC sampling approach called
|
|
335
|
-
[No U Turn Sampler (NUTS)](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/NoUTurnSampler)
|
|
336
|
-
which can be compute intensive. To help with this, GPU support has been
|
|
337
|
-
developed across the library (out-of-the-box) using tensors. We recommend
|
|
338
|
-
running your Meridian model on GPUs to get real time optimization results and
|
|
339
|
-
significantly reduce training time.
|
|
340
|
-
|
|
341
|
-
## Meridian Documentation & Tutorials
|
|
342
|
-
|
|
343
|
-
The following documentation, colab, and video resources will help you get
|
|
344
|
-
started quickly with using Meridian:
|
|
345
|
-
|
|
346
|
-
| Resource | Description |
|
|
347
|
-
| --------------------------- | ---------------------------------------------- |
|
|
348
|
-
| [Meridian documentation][1] | Main landing page for Meridian documentation. |
|
|
349
|
-
| [Meridian basics][2] | Learn about Meridian features, methodologies, and the model math. |
|
|
350
|
-
| [Getting started colab][3] | Install and quickly learn how to use Meridian with this colab tutorial using sample data. |
|
|
351
|
-
| [User guide][4] | A detailed walk-through of how to use Meridian and generating visualizations using your own data. |
|
|
352
|
-
| [Pre-modeling][5] | Prepare and analyze your data before modeling. |
|
|
353
|
-
| [Modeling][6] | Modeling guidance for model refinement and edge cases. |
|
|
354
|
-
| [Post-modeling][7] | Post-modeling guidance for model fit, visualizations, optimizations, refreshing the model, and debugging. |
|
|
355
|
-
| [Migrate from LMMM][8] | Learn about the differences between Meridian and LightweightMMM as you consider migrating. |
|
|
356
|
-
| [API Reference][9] | API reference documentation for the Meridian package. |
|
|
357
|
-
| [Reference list][10] | White papers and other referenced material. |
|
|
358
|
-
|
|
359
|
-
[1]: https://developers.google.com/meridian
|
|
360
|
-
[2]: https://developers.google.com/meridian/docs/basics/about-the-project
|
|
361
|
-
[3]: https://developers.google.com/meridian/notebook/meridian-getting-started
|
|
362
|
-
[4]: https://developers.google.com/meridian/docs/user-guide/installing
|
|
363
|
-
[5]: https://developers.google.com/meridian/docs/user-guide/collect-data
|
|
364
|
-
[6]: https://developers.google.com/meridian/docs/advanced-modeling/control-variables
|
|
365
|
-
[7]: https://developers.google.com/meridian/docs/advanced-modeling/model-fit
|
|
366
|
-
[8]: https://developers.google.com/meridian/docs/migrate
|
|
367
|
-
[9]: https://developers.google.com/meridian/reference/api/meridian
|
|
368
|
-
[10]: https://developers.google.com/meridian/docs/reference-list
|
|
369
|
-
|
|
370
|
-
## Support
|
|
371
|
-
|
|
372
|
-
**Questions about methodology**: Please see the [Modeling](https://developers.google.com/meridian/docs/basics/about-the-project) tab in the technical documentation.
|
|
373
|
-
|
|
374
|
-
**Issues installing or using Meridian**: Feel free to post questions in the
|
|
375
|
-
[Discussions](https://github.com/google/meridian/discussions) or [Issues](https://github.com/google/meridian/issues) tabs of the Meridian GitHub repository. The Meridian team responds to
|
|
376
|
-
these questions weekly in batches, so please be patient and don't reach out
|
|
377
|
-
directly to your Google Account teams.
|
|
378
|
-
|
|
379
|
-
**Bug reports**: Please post bug reports to the [Issues](https://github.com/google/meridian/issues)
|
|
380
|
-
tab of the Meridian GitHub repository. We also encourage the community to share
|
|
381
|
-
tips and advice with each other on the [Issues](https://github.com/google/meridian/issues)
|
|
382
|
-
tab. When our team addresses or resolves a new bug, we will notify you through
|
|
383
|
-
the comments on the issue.
|
|
384
|
-
|
|
385
|
-
**Feature requests**: Please post these to the [Discussions](https://github.com/google/meridian/discussions)
|
|
386
|
-
tab of the Meridian GitHub repository. We have an internal roadmap for Meridian
|
|
387
|
-
development, but would love your inputs for new feature requests so that we can
|
|
388
|
-
prioritize them based on the roadmap.
|
|
389
|
-
|
|
390
|
-
**Pull requests**: These are appreciated but are very difficult for us to merge
|
|
391
|
-
because the code in this repository is linked to Google internal systems and has
|
|
392
|
-
to pass internal review. If you submit a pull request and we believe that we can
|
|
393
|
-
incorporate a change in the base code, we will reach out to you directly about
|
|
394
|
-
this.
|
|
395
|
-
|
|
396
|
-
## Citing Meridian
|
|
397
|
-
|
|
398
|
-
To cite this repository:
|
|
399
|
-
|
|
400
|
-
<!-- mdlint off(SNIPPET_INVALID_LANGUAGE) -->
|
|
401
|
-
```BibTeX
|
|
402
|
-
@software{meridian_github,
|
|
403
|
-
author = {Google Meridian Marketing Mix Modeling Team},
|
|
404
|
-
title = {Meridian: Marketing Mix Modeling},
|
|
405
|
-
url = {https://github.com/google/meridian},
|
|
406
|
-
version = {1.2.1},
|
|
407
|
-
year = {2025},
|
|
408
|
-
}
|
|
409
|
-
```
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
google_meridian-1.2.1.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
2
|
-
meridian/__init__.py,sha256=0fOT5oNZF7-pbiWWGUefV-ysafttieG079m1ijMFQO8,861
|
|
3
|
-
meridian/constants.py,sha256=19A4Hzhfdrdj6CzjoqKxqTg3d3wbTGHgvz9TBwdIRZg,18485
|
|
4
|
-
meridian/version.py,sha256=2wFL4gzqzx21aqU1XHRxIuP5xZOZFXVxiDQUG5v38do,644
|
|
5
|
-
meridian/analysis/__init__.py,sha256=nGBYz7k9FVdadO_WVGMKJcfq7Yy_TuuP8zgee4i9pSA,836
|
|
6
|
-
meridian/analysis/analyzer.py,sha256=ftcjavIPKy1y0uL_uEKfFaSYnWdQYMc8YBnw8p7mf6g,217876
|
|
7
|
-
meridian/analysis/formatter.py,sha256=ENIdR1CRiaVqIGEXx1HcnsA4ewgDD_nhsYCweJAThaw,7270
|
|
8
|
-
meridian/analysis/optimizer.py,sha256=4LhEbPBz8NtWWzwLuYiAhkuTiLfIJbhhdBPn973EVeQ,120492
|
|
9
|
-
meridian/analysis/summarizer.py,sha256=VF4uuZ5xavrfZdLk1Cwf1ZPrkiQ2-kVnLkjvpWtcZ98,19367
|
|
10
|
-
meridian/analysis/summary_text.py,sha256=I_smDkZJYp2j77ea-9AIbgeraDa7-qUYyb-IthP2qO4,12438
|
|
11
|
-
meridian/analysis/test_utils.py,sha256=z5NBjcOzvM7xwwTFI_26sfLyyGLYCd21j52eygQHBRs,77911
|
|
12
|
-
meridian/analysis/visualizer.py,sha256=RgrqIBRFG_HJBlz_IcOVaB3jSeXpD5PHLSkkGy2rWJs,94537
|
|
13
|
-
meridian/analysis/templates/card.html.jinja,sha256=pv4MVbQ25CcvtZY-LH7bFW0OSeHobkeEkAleB1sfQ14,1284
|
|
14
|
-
meridian/analysis/templates/chart.html.jinja,sha256=87i0xnXHRBoLLxBpKv2i960TLToWq4r1aVQZqaXIeMQ,1086
|
|
15
|
-
meridian/analysis/templates/chips.html.jinja,sha256=Az0tQwF_-b03JDLyOzpeH-8fb-6jgJgbNfnUUSm-q6E,645
|
|
16
|
-
meridian/analysis/templates/insights.html.jinja,sha256=6hEWipbOMiMzs9QGZ6dcB_73tNkj0ZtNiC8E89a98zg,606
|
|
17
|
-
meridian/analysis/templates/stats.html.jinja,sha256=9hQOG02FX1IHVIvdWS_-LI2bbSaqdyHEtCZkiArwAg0,772
|
|
18
|
-
meridian/analysis/templates/style.css,sha256=RODTWc2pXcG9zW3q9SEJpVXgeD-WwQgzLpmFcbXPhLg,5492
|
|
19
|
-
meridian/analysis/templates/style.scss,sha256=nSrZOpcIrVyiL4eC9jLUlxIZtAKZ0Rt8pwfk4H1nMrs,5076
|
|
20
|
-
meridian/analysis/templates/summary.html.jinja,sha256=LuENVDHYIpNo4pzloYaCR2K9XN1Ow6_9oQOcOwD9nGg,1707
|
|
21
|
-
meridian/analysis/templates/table.html.jinja,sha256=mvLMZx92RcD2JAS2w2eZtfYG-6WdfwYVo7pM8TbHp4g,1176
|
|
22
|
-
meridian/backend/__init__.py,sha256=9DCcwp-9hIr66vciMhdkROndO40AAlJXjtrAbFihero,28454
|
|
23
|
-
meridian/backend/config.py,sha256=B9VQnhBfg9RW04GNbt7F5uCugByenoJzt-keFLLYEp8,3561
|
|
24
|
-
meridian/backend/test_utils.py,sha256=jmlFdo3mQrDG-gmxd8GqYAhi_GdAXRUjRkHxRY0z_1A,6410
|
|
25
|
-
meridian/data/__init__.py,sha256=StIe-wfYnnbfUbKtZHwnAQcRQUS8XCZk_PCaEzw90Ww,929
|
|
26
|
-
meridian/data/arg_builder.py,sha256=Kqlt88bOqFj6D3xNwvWo4MBwNwcDFHzd-wMfEOmLoPU,3741
|
|
27
|
-
meridian/data/data_frame_input_data_builder.py,sha256=_hexZMFAuAowgo6FaOGElHSFHqhGnHQwEEBcwnT3zUE,27295
|
|
28
|
-
meridian/data/input_data.py,sha256=Qlxm4El6h1SRPsWDqZoKkOcMtrjiRWr3z8sU2mtghRA,43151
|
|
29
|
-
meridian/data/input_data_builder.py,sha256=tbZjVXPDfmtndVyJA0fmzGzZwZb0RCEjXOTXb-ga8Nc,25648
|
|
30
|
-
meridian/data/load.py,sha256=X2nmYCC-7A0RUgmdolTqCt0TD3NEZabQ5oGv-TugE00,40129
|
|
31
|
-
meridian/data/nd_array_input_data_builder.py,sha256=lfpmnENGuSGKyUd7bDGAwoLqHqteOKmHdKl0VI2wCQA,16341
|
|
32
|
-
meridian/data/test_utils.py,sha256=mw-QPTP15oXf32I7cxMe8iSFBLB3seqEiITZMTz_Eg8,59838
|
|
33
|
-
meridian/data/time_coordinates.py,sha256=C5A5fscSLjPH6G9YT8OspgIlCrkMY7y8dMFEt3tNSnE,9874
|
|
34
|
-
meridian/mlflow/__init__.py,sha256=elwXUqPQYi7VF9PYjelU1tydfcUrmtuoq6eJCOnV9bk,693
|
|
35
|
-
meridian/mlflow/autolog.py,sha256=SZsrynLjozcyrAFCNWiqchSa2yOszVnwFBGz23BmWUU,6379
|
|
36
|
-
meridian/model/__init__.py,sha256=9NFfqUE5WgFc-9lQMkbfkwwV-bQIz0tsQ_3Jyq0A4SU,982
|
|
37
|
-
meridian/model/adstock_hill.py,sha256=HoRKjyL03pCTBz6Utof9wEvlQCFM43BvrEW_oupj7NU,17688
|
|
38
|
-
meridian/model/knots.py,sha256=1geYCcWHjXy1Uzwi5bxIuHaIY2rfSYVfneEdPetcMA8,25978
|
|
39
|
-
meridian/model/media.py,sha256=ZWYLN2iHLYWYrSRyR03L8DgFdVtgRs37JfTVjbzynBU,14364
|
|
40
|
-
meridian/model/model.py,sha256=D6pQOD0A7ZE7MhDd2tLMSB7sVmDwyzJ82DuKaF_auVs,66516
|
|
41
|
-
meridian/model/model_test_data.py,sha256=cG_8vBMRJJ3O63uVDz4x1tdJRaVQXsYQtQvfScBoXV4,21878
|
|
42
|
-
meridian/model/posterior_sampler.py,sha256=xFnvRw-Arz8j6a2oj5ywOCN1r5JcbZRADBWOrdVPFE8,26910
|
|
43
|
-
meridian/model/prior_distribution.py,sha256=xHNysn9sGjQL4xUOyoeMbTJwYyCmTbXykvEA9rNkkXY,57081
|
|
44
|
-
meridian/model/prior_sampler.py,sha256=IKkVF-TUN3tFvnHKRrXI3A5slKq1vPcUn5e3u9UsfPU,23422
|
|
45
|
-
meridian/model/spec.py,sha256=6ioI_wU6E2c-i7oltJUjBYHb3FxhRCyhWtuCx8GqkFA,19206
|
|
46
|
-
meridian/model/transformers.py,sha256=68pf6-6nG2eAgrE-ZM30S-cWCmNTftrRQZKjIoVHRO4,8230
|
|
47
|
-
meridian/model/eda/__init__.py,sha256=MrGW1NER0JNsnWJRO5aeFEmMTDVYi4HgMmLXZaw_bbk,685
|
|
48
|
-
meridian/model/eda/eda_engine.py,sha256=QjOFril0NTonBg9mqx6nrBUfK5F_A53UcX-l6QSqgo8,25462
|
|
49
|
-
google_meridian-1.2.1.dist-info/METADATA,sha256=zfGooQwkjN_mFUPDu7Y09SZ6euAEo_zaG4V_RAUt0T4,22462
|
|
50
|
-
google_meridian-1.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
51
|
-
google_meridian-1.2.1.dist-info/top_level.txt,sha256=nwaCebZvvU34EopTKZsjK0OMTFjVnkf4FfnBN_TAc0g,9
|
|
52
|
-
google_meridian-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|