View source on GitHub
|
Serializes and deserializes a Meridian prior distributions container into a Distribution proto.
Inherits From: Serde
schema.serde.distribution.DistributionSerde(
function_registry: FunctionRegistry
)
Attributes | |
|---|---|
function_registry
|
|
Methods
deserialize
deserialize(
serialized: MeridianPriorDistributions,
serialized_version: str = '',
force_deserialization: bool = False
) -> pd.PriorDistribution
Deserializes the PriorTfpDistributions proto.
WARNING: If any custom functions in the function registry are modified after serialization, the deserialized model can differ from the original model, as the original function's behavior is no longer guaranteed. This will result in an error during deserialization.
For users who are intentionally changing functions and are confident that the changes will not affect the deserialized model, you can bypass safety mechanisms to force deserialization. See example:
| Args | |
|---|---|
serialized
|
A serialized PriorDistributions object.
|
serialized_version
|
The version of the serialized Meridian model. This is used to handle changes in deserialization logic across different versions. |
force_deserialization
|
If True, bypasses the safety check that validates
whether functions within 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 deserialized PriorDistribution object.
|
serialize
serialize(
obj: pd.PriorDistribution
) -> meridian_pb.PriorTfpDistributions
Serializes the given Meridian priors container into a MeridianPriorDistributions proto.
View source on GitHub