Skip to content

Update the serialization process #2379

@isofer

Description

@isofer

PyMC-Marketing have a list of known failures (see below), and
the codebase uses at least four different serialization patterns with no unified
contract, making it difficult for users to create custom serializable components.

Current Serialization Patterns (4+, inconsistent)

  1. to_dict()/from_dict() + register_deserialization — adstock, saturation, HSGP, fourier, events/Basis
  2. Pydantic model_dump()/model_validate() — HSGPKwargs, Scaling, LinearTrend, MuEffect subclasses
  3. singledispatch serializers — per-type handlers for MuEffects in multidimensional.py
  4. Manual JSON encodingcreate_idata_attrs() / attrs_to_init_kwargs() on MMM

Design doc (still WIP): https://github.com/pymc-labs/pymc-marketing/blob/isofer/2379-update-serialization-process/docs/plans/2026-03-05-serialization-overhaul-design.md

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions