DeferredFactory#
- class pymc_marketing.serialization.DeferredFactory(**data)[source]#
Serializable recipe for creating objects with non-serializable state.
Instead of storing a live object (e.g., a Prior with PyTensor tensor parameters), store the factory function path and its scalar arguments. Call
resolve()at build_model() time to create the actual object.Methods
DeferredFactory.__init__(**data)Create a new model by parsing and validating input data from keyword arguments.
DeferredFactory.construct([_fields_set])DeferredFactory.copy(*[, include, exclude, ...])Returns a copy of the model.
DeferredFactory.dict(*[, include, exclude, ...])Reconstruct a DeferredFactory from a dict.
DeferredFactory.json(*[, include, exclude, ...])DeferredFactory.model_construct([_fields_set])Creates a new instance of the
Modelclass with validated data.DeferredFactory.model_copy(*[, update, deep])!!! abstract "Usage Documentation"
DeferredFactory.model_dump(*[, mode, ...])!!! abstract "Usage Documentation"
DeferredFactory.model_dump_json(*[, indent, ...])!!! abstract "Usage Documentation"
Generates a JSON schema for a model class.
Compute the class name for parametrizations of generic classes.
DeferredFactory.model_post_init(context, /)Override this method to perform additional initialization after
__init__andmodel_construct.DeferredFactory.model_rebuild(*[, force, ...])Try to rebuild the pydantic-core schema for the model.
DeferredFactory.model_validate(obj, *[, ...])Validate a pydantic model instance.
DeferredFactory.model_validate_json(json_data, *)!!! abstract "Usage Documentation"
Validate the given object with string data against the Pydantic model.
DeferredFactory.parse_file(path, *[, ...])DeferredFactory.parse_raw(b, *[, ...])Import the factory function and call it with kwargs.
DeferredFactory.schema([by_alias, ref_template])DeferredFactory.schema_json(*[, by_alias, ...])Serialize the deferred factory to a dict.
DeferredFactory.update_forward_refs(**localns)DeferredFactory.validate(value)Attributes
model_computed_fieldsmodel_configConfiguration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].model_extraGet extra fields set during validation.
model_fieldsmodel_fields_setReturns the set of fields that have been explicitly set on this model instance.
factorykwargs