Skip to content

Commit

Permalink
Media transformation class and different transformations based on sub…
Browse files Browse the repository at this point in the history
…sets of channels (pymc-labs#968)
  • Loading branch information
wd60622 authored and radiokosmos committed Sep 1, 2024
1 parent 9db32bf commit e7cc642
Show file tree
Hide file tree
Showing 6 changed files with 628 additions and 0 deletions.
Binary file modified docs/source/uml/classes_mmm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/uml/packages_mmm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions pymc_marketing/mmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
saturation_from_dict,
)
from pymc_marketing.mmm.fourier import MonthlyFourier, YearlyFourier
from pymc_marketing.mmm.media_transformation import (
MediaConfig,
MediaConfigList,
MediaTransformation,
)
from pymc_marketing.mmm.mmm import MMM
from pymc_marketing.mmm.preprocessing import (
preprocessing_method_X,
Expand All @@ -46,6 +51,9 @@
from pymc_marketing.mmm.validating import validation_method_X, validation_method_y

__all__ = [
"MediaTransformation",
"MediaConfigList",
"MediaConfig",
"AdstockTransformation",
"BaseValidateMMM",
"DelayedAdstock",
Expand Down
17 changes: 17 additions & 0 deletions pymc_marketing/mmm/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ def __repr__(self) -> str:
")"
)

def set_dims_for_all_priors(self, dims: Dims):
"""Convinience method to set the dims for all priors.
Parameters
----------
dims : Dims
The dims for the priors.
Returns
-------
Transformation
"""
for prior in self.function_priors.values():
prior.dims = dims

return self

def to_dict(self) -> dict[str, Any]:
"""Convert the transformation to a dictionary.
Expand Down
Loading

0 comments on commit e7cc642

Please sign in to comment.