Model context for Meridian.
meridian
.
model
.
context
.
ModelContext
(
input_data
:
meridian
.
data
.
input_data
.
InputData
,
model_spec
:
meridian
.
model
.
spec
.
ModelSpec
)
This class contains all model parameters that do not change between the runs of Meridian.
Attributes
The non-media treatments values are scaled by population (for channels where non_media_population_scaling_id
is True
) and normalized by centering and
scaling with means and standard deviations.
Methods
create_inference_data_coords
create_inference_data_coords
(
n_chains
:
int
,
n_draws
:
int
)
->
Mapping
[
str
,
np
.
ndarray
|
Sequence
[
str
]]
Creates data coordinates for inference data.
create_inference_data_dims
create_inference_data_dims
()
->
Mapping
[
str
,
Sequence
[
str
]]
Creates data dimensions for inference data.
expand_selected_time_dims
expand_selected_time_dims
(
start_date
:
meridian
.
data
.
time_coordinates
.
Date
=
None
,
end_date
:
meridian
.
data
.
time_coordinates
.
Date
=
None
)
->
(
list
[
str
]
|
None
)
Validates and returns time dimension values based on the selected times.
If both start_date
and end_date
are None, returns None. If specified,
both start_date
and end_date
are inclusive, and must be present in the
time coordinates of the input data.
start_date
end_date
start_date
and end_date
correspond to the entire time range in the input data.
start_date
or end_date
is not in the input data time
dimensions. populate_cached_properties
populate_cached_properties
()
Eagerly activates all cached properties.
This is useful for creating a tf.function
computation graph with this
Meridian object as part of a captured closure. Within the computation graph,
internal state mutations are problematic, and so this method freezes the
object's states before the computation graph is created.



