Serializes and deserializes a Meridian model into an MmmKernel
proto.
Inherits From: Serde
Methods
deserialize
deserialize
(
serialized
:
kernel_pb
.
MmmKernel
,
serialized_version
:
str
=
''
,
distribution_function_registry
:
(
schema
.
serde
.
distribution
.
FunctionRegistry
|
None
)
=
None
,
eda_function_registry
:
(
schema
.
serde
.
distribution
.
FunctionRegistry
|
None
)
=
None
,
force_deserialization
=
False
)
->
model
.
Meridian
Deserializes the given MmmKernel
proto into a Meridian model.
Args
serialized
The serialized object in the form of an
MmmKernel
proto.serialized_version
The version of the serialized model. This is used to
handle changes in deserialization logic across different versions.
distribution_function_registry
Optional. A lookup table that maps string
keys to custom functions to be used as parameters in various
tfp.distributions
.eda_function_registry
A lookup table containing custom functions used by
EDASpec
objects.force_deserialization
If True, bypasses the safety check that validates
whether functions within a function registry have changed after
serialization. Use with caution. This should only be used if you have
intentionally modified a custom function and are confident that the
changes will not affect the deserialized model. A safer alternative is
to first deserialize the model with the original functions and then
serialize it with the new ones.
Returns
A Meridian model object.
serialize
serialize
(
obj
:
model
.
Meridian
,
model_id
:
str
=
''
,
meridian_version
:
semver
.
VersionInfo
=
_VERSION_INFO
,
include_convergence_info
:
bool
=
False
,
distribution_function_registry
:
(
schema
.
serde
.
distribution
.
FunctionRegistry
|
None
)
=
None
,
eda_function_registry
:
(
schema
.
serde
.
distribution
.
FunctionRegistry
|
None
)
=
None
)
->
kernel_pb
.
MmmKernel
Serializes the given Meridian model into an MmmKernel
proto.
Args
obj
The Meridian model to serialize.
model_id
The ID of the model.
meridian_version
The version of the Meridian model.
include_convergence_info
Whether to include convergence information.
distribution_function_registry
Optional. A lookup table that maps string
keys to custom functions to be used as parameters in various
tfp.distributions
.eda_function_registry
A lookup table that maps string keys to custom
functions to be used in
EDASpec
.
Returns
An
MmmKernel
proto representing the serialized model.


