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 build_model abstractmethod to ModelBuilder #142

Merged
merged 6 commits into from
Apr 19, 2023

Conversation

michaelraczycki
Copy link
Collaborator

@michaelraczycki michaelraczycki commented Apr 16, 2023

changes to ModelBuilder that are required for full integration with MMM, the final shape is still open for discussion.
main changes:
-build_model moved out of constructor of baseMMM and called in fit() in model_builder
-abstract definition of build_model added to model_builder
-abstract definition of _serialisable_model_config added to model_builder (solves the unserialisability of time series
-save now requires model to be fit first
-added test checking that RuntimeError is raised if save is called before fit
-model is not build at initialisation of MMM, but with first fit, reason is that chain calling constructors was causing issues with object creation timing resulting in not reliable inheritance

@michaelraczycki michaelraczycki requested a review from twiecki April 17, 2023 08:08
@michaelraczycki michaelraczycki added the enhancements New feature or request label Apr 17, 2023
@ricardoV94 ricardoV94 changed the title adaptations to integrate with mmm Add build_model abstractmethod to ModelBuilder Apr 19, 2023
ricardoV94
ricardoV94 previously approved these changes Apr 19, 2023
Copy link
Member

@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.

LGTM, any specific thing you need input on?

>>> 'obs_error': 2,
>>> }
>>> 'a' : {
>>> 'a_loc': 7,
Copy link
Member

Choose a reason for hiding this comment

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

Should this not just be loc, the a seems redundant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

true, good catch

@@ -191,7 +220,7 @@ def load(cls, fname: str):
data=idata.fit_data.to_dataframe(),
)
model_builder.idata = idata
model_builder.build()
model_builder.idata = model_builder.fit()
Copy link
Member

Choose a reason for hiding this comment

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

What if the model was already fit?

@michaelraczycki michaelraczycki requested a review from twiecki April 19, 2023 13:08
@twiecki twiecki merged commit e38da06 into pymc-devs:main Apr 19, 2023
@twiecki
Copy link
Member

twiecki commented Apr 19, 2023

👍

@michaelraczycki michaelraczycki deleted the mmm_related_changes branch July 5, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants