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

Register and allow custom transform for Prior class #972

Merged
merged 3 commits into from
Aug 25, 2024

Conversation

wd60622
Copy link
Contributor

@wd60622 wd60622 commented Aug 24, 2024

Description

Register with pymc_marketing.prior.register_tensor_transform function before using in the Prior class transform argument.

from pymc_marketing.prior import Prior, register_tensor_transform

def custom_transform(x):
    return x ** 2

register_tensor_transform("foo_bar", custom_transform)

custom_distribution = Prior("Normal", transform="foo_bar")

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--972.org.readthedocs.build/en/972/

@wd60622 wd60622 added enhancement New feature or request Prior class labels Aug 24, 2024
Copy link

codecov bot commented Aug 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.62%. Comparing base (288b8e8) to head (6d28e50).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #972   +/-   ##
=======================================
  Coverage   95.61%   95.62%           
=======================================
  Files          35       35           
  Lines        3489     3496    +7     
=======================================
+ Hits         3336     3343    +7     
  Misses        153      153           

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

Copy link
Collaborator

@juanitorduz juanitorduz left a comment

Choose a reason for hiding this comment

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

Nice!

@juanitorduz juanitorduz merged commit 0c90ba8 into main Aug 25, 2024
12 checks passed
radiokosmos pushed a commit to radiokosmos/pymc-marketing that referenced this pull request Sep 3, 2024
* allow register and use custom transform

* add to the example block
twiecki pushed a commit that referenced this pull request Sep 10, 2024
* allow register and use custom transform

* add to the example block
twiecki pushed a commit that referenced this pull request Sep 10, 2024
* allow register and use custom transform

* add to the example block
@twiecki twiecki deleted the custom-transforms branch September 11, 2024 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Prior class
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arbitrary Prior class transformations
2 participants