schema.serde.meridian_serde.MeridianSerde

Serializes and deserializes a Meridian model into an MmmKernel proto.

Inherits From: Serde

Methods

deserialize

View source

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

View source

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.