Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle TVP media in channel_contributions_forward_pass #998

Draft
wants to merge 172 commits into
base: main
Choose a base branch
from

Conversation

radiokosmos
Copy link
Contributor

@radiokosmos radiokosmos commented Sep 4, 2024

Description

Related Issue

Checklist

Modules affected

  • MMM
  • CLV

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc-marketing--998.org.readthedocs.build/en/998/

wd60622 and others added 30 commits April 2, 2024 15:07
* add scaling into lift test method

* test scaling methods

* test change of MMM likelihood

* link up beta_channel parameters

* change name to sigma

* reorganize and edit

* closes pymc-labs#406

* address the feedback in docstrings

* add more to docstring

* format the docstring

* be verbose for future devs

* be explicit for the column max values

* incorporate the feedback

* hide cells and add to intro

* add conclusion

* switch to header 2

* run notebook through

* move the types together

* separate model estimated from empirical

* fix typos
* drop python 3.9

* try python 3.12

* undo try python 3.12
* improve nb

* rm warnings and add link to lifetimes quickstart

* address comments

* feedback part 3

* remove warnings manually
* add more info to the notebook

* hide plots code

* fix plot y labels

* fix plot outputs and remove model build

* improve final note probability plots

* address comments

* use quickstart dataset

* feedback part 3

* remowe warnings manually

* feedback part 4
* improve mmm docs init

* add more code examples to docstrings

* minor improvemeents

* typo

* better phrasing

* add thomas suggestion
* move fixtures to conftest

* docstrings and moved set_model_fit to conftest

* fixed pandas quickstart warnings

* revert to MockModel and add ParetoNBD support

* quickstart edit for issue 609

* notebook edit
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.3.7](astral-sh/ruff-pre-commit@v0.3.5...v0.3.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Juan Orduz <[email protected]>
* fix potential bugs

* minor improvements

* remove rule for nb

* fix test

* improve tests syntax

* use stacklevel 2 for warnings

* use stacklevel 1 for warnings as they are used in public methods

* ignore B904

* undo change

* ricardos feedback

* use fit_posterior

* Update pymc_marketing/clv/models/gamma_gamma.py

Co-authored-by: Ricardo Vieira <[email protected]>

* last fix XD

---------

Co-authored-by: Ricardo Vieira <[email protected]>
* notebook opening and imports

* model definition markdown

* Data Load Notebook section

* WIP model fitting section

* added notebook to docs directory

* notebook edits and graph code

* ppc section and nb cleanup

* demz sampling and WIP plotting

* WIP predictive plots

* WIP heatmap plots

* predictive plots

* WIP covariates and nbqa-ruff edits

* covariate section

* plot additions

* fig sizes

* remove model file
…book (pymc-labs#651)

* add spaces, increase indentation, and fix number order

* explicit with 6
* Creating plot waterfall

Co-Authored-By: Carlos Trujillo <[email protected]>

* requested changes

* pre-commit

---------

Co-authored-by: Carlos Trujillo <[email protected]>
Databricks should have a lower-case b.
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.4.2](astral-sh/ruff-pre-commit@v0.4.1...v0.4.2)
- [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](pre-commit/mirrors-mypy@v1.9.0...v1.10.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* support for negative values and dates (if used)

* fix terrible spelling

* test dates in coords

* cover numpy objects

* consolidate the tests
PabloRoque and others added 18 commits August 23, 2024 00:27
…abs#960)

* Enforce check_parameters in geometric_adstock

* Remove check_parameters on l_max. Revert to original test

* Add test_geometric_adstock_bad_alpha

* use ge, le instead of gt,lt

* Update tests/mmm/test_transformers.py

Co-authored-by: Will Dean <[email protected]>

* Simplify test parameters

* Update tests/mmm/test_transformers.py

Co-authored-by: Will Dean <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Will Dean <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…#967)

* change repo and python file change to kick off

* comment to check for failure

* using the repo

* delete to trigger

* the previous trigger

* push up again

* check for the owner being pymc-labs

* remove unused

* only run after merge to main
* deprecations and moving files

* Update UML Diagrams

* change the imports in notebooks

* push up the code / test changes. need to run

* remove _get_\w*_function tests

* rerun the tvp notebook

* remove stale test

* move away from string initialization

* change the tvp media example
* allow register and use custom transform

* add to the example block
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](astral-sh/ruff-pre-commit@v0.6.1...v0.6.2)
- [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](pre-commit/mirrors-mypy@v1.11.1...v1.11.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add table

* sync index

* empty

* improvements
* nb init

* add param stability

* crps init

* add crps to package

* make mypy happy

* clean

* relax req

* update path

* add crps test

* first iteration

* improvements

* improve tests

* improve tests

* improve references

* feedback 1

* add examples
…ocs (pymc-labs#992)

* Changed pt=pt to pt_lib = None to avoid showing full module path in docs

* Changed pt to pt_lib inside calculate_lift_measurements_from_curve
* push up some linear-trend work I had

* image for the documentation

* start the slopes at t=0

* additional checks at init

* import at mmm module

* update the image

* Move to reference section

* Move coords to single line

* Add hierarchical trend example

* add image for the example

* migrate to pydantic

* update images after seed

* Correct the latex

* fix check from tests
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.2 → v0.6.3](astral-sh/ruff-pre-commit@v0.6.2...v0.6.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@radiokosmos
Copy link
Contributor Author

I am not sure if it's right logic to do time_varying_channel_contributions_forward_pass and need some help with relevant test

Copy link
Contributor

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some thoughts to deduplicate logic

pymc_marketing/mmm/mmm.py Show resolved Hide resolved
Comment on lines +1053 to +1057
time_index = (
np.arange(0, self.preprocessed_data["X"].shape[0])
if self.time_varying_media
else None
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we know if the dates are correct? Is this only used for the insampel data? What if the channel_contributions input are from a subset of the input. We will likely need to use the infer_time_index if this is used for new data. This a complaint of mine from the original implementation. If it is always used in the context of the insample, can we not just use the self._time_index variables create in fit call.

@wd60622 wd60622 changed the title Draft: Issue 819 Handle TVP media in channel_contributions_forward_pass Sep 6, 2024
@wd60622 wd60622 added the bug Something isn't working label Sep 6, 2024
@wd60622
Copy link
Contributor

wd60622 commented Oct 23, 2024

Hi @radiokosmos
Are you still interested in this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working MMM
Projects
None yet
Development

Successfully merging this pull request may close these issues.