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

model.fit doesn't remove prior samples #741

Merged
merged 9 commits into from
Jun 12, 2024
Merged

model.fit doesn't remove prior samples #741

merged 9 commits into from
Jun 12, 2024

Conversation

wd60622
Copy link
Contributor

@wd60622 wd60622 commented Jun 12, 2024

Description

The following workflow is now supported

model.sample_prior_predictive(X)
model.fit(X, y)
assert "prior" in model.idata

Doesn't touch on the "fit_data_group" introduced with #414

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

@wd60622 wd60622 added the bug Something isn't working label Jun 12, 2024
@@ -86,7 +86,7 @@ def __init__(
self.model_config = (
self.default_model_config | model_config
) # parameters for priors etc.
self.model: pm.Model | None = None # Set by build_model
self.model: pm.Model
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So we don't have to check self.model is None all the time...

Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.81%. Comparing base (664b5ca) to head (4643bc2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #741      +/-   ##
==========================================
+ Coverage   93.74%   93.81%   +0.07%     
==========================================
  Files          27       27              
  Lines        2828     2828              
==========================================
+ Hits         2651     2653       +2     
+ Misses        177      175       -2     

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

@wd60622 wd60622 requested a review from juanitorduz June 12, 2024 19:37
@wd60622 wd60622 changed the title Don't remove prior samples model.fit doesn't remove prior samples Jun 12, 2024
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.

🚀

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.

plot_prior_predictive() gives error "RuntimeError: The model hasn't been fit yet, call .fit() first"
2 participants