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

Add Weibull CDF and PDF Adstock Transformations #499

Merged
merged 12 commits into from
Jan 29, 2024

Conversation

abdalazizrashid
Copy link
Contributor

@abdalazizrashid abdalazizrashid commented Jan 26, 2024

Description

This pull request add the weibull_adstock function, providing support for both Weibull CDF and PDF adstock transformations.

image

Related Issue

Checklist

  • Checked that the pre-commit linting/style checks pass
  • Included tests that prove the fix is effective or that the new feature works
  • Added necessary documentation (docstrings and/or example notebooks)

Modules affected

  • MMM
  • CLV

Type of change

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

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

Copy link
Contributor

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Nice work!

I left a couple of comments, no major issue

k=1,
l_max: int = 12,
axis: int = 0,
type: WeibullType = WeibullType.PDF,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use string or a boolean variable so users don't have to import an object to be able to parametrize the function

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

@abdalazizrashid abdalazizrashid Jan 26, 2024

Choose a reason for hiding this comment

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

We have a similar interface for batched_convolution too. Maybe make it type: WeibullType | str = WeibullType.PDF?

Copy link
Contributor

@wd60622 wd60622 Jan 26, 2024

Choose a reason for hiding this comment

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

It will only every be pdf or not pdf (cdf), right? Think the boolean simplifies it heavily

tests/mmm/test_transformers.py Outdated Show resolved Hide resolved
tests/mmm/test_transformers.py Outdated Show resolved Hide resolved
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 small comment on the docstring arg type

But other than that, looks good!

Shape parameter of the Weibull distribution. Must be positive.
l_max : int, by default 12
Maximum duration of carryover effect.
type : WeibullType, by default WeibullType.PDF
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe good to add string to match with the type hint

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (964957f) 91.24% compared to head (a208794) 91.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #499      +/-   ##
==========================================
+ Coverage   91.24%   91.32%   +0.08%     
==========================================
  Files          21       21              
  Lines        2044     2063      +19     
==========================================
+ Hits         1865     1884      +19     
  Misses        179      179              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@abdalazizrashid abdalazizrashid merged commit 98ae8cb into main Jan 29, 2024
13 checks passed
@abdalazizrashid abdalazizrashid deleted the Weibull-transformations branch January 29, 2024 15:20
@juanitorduz juanitorduz added MMM enhancement New feature or request labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request MMM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementing a wider selection of variable transformations
4 participants