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, ...])

DeferredFactory.from_dict(data)

Reconstruct a DeferredFactory from a dict.

DeferredFactory.from_orm(obj)

DeferredFactory.json(*[, include, exclude, ...])

DeferredFactory.model_construct([_fields_set])

Creates a new instance of the Model class 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"

DeferredFactory.model_json_schema([...])

Generates a JSON schema for a model class.

DeferredFactory.model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

DeferredFactory.model_post_init(context, /)

Override this method to perform additional initialization after __init__ and model_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"

DeferredFactory.model_validate_strings(obj, *)

Validate the given object with string data against the Pydantic model.

DeferredFactory.parse_file(path, *[, ...])

DeferredFactory.parse_obj(obj)

DeferredFactory.parse_raw(b, *[, ...])

DeferredFactory.resolve()

Import the factory function and call it with kwargs.

DeferredFactory.schema([by_alias, ref_template])

DeferredFactory.schema_json(*[, by_alias, ...])

DeferredFactory.to_dict()

Serialize the deferred factory to a dict.

DeferredFactory.update_forward_refs(**localns)

DeferredFactory.validate(value)

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

factory

kwargs