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

Fix initval setters leading to NotImplementedError #547

Conversation

AlexanderFengler
Copy link
Collaborator

@AlexanderFengler AlexanderFengler commented Aug 14, 2024

This changes the logic on how we store initvals.
We now attach and update a class property .initvals that holds a dictionary.
This dictionary is passed as initvals argument to the .sampler() method.

All pre-processing of initial values now targets this dictionary, instead of attempting changes to the pymc_model directly.

@AlexanderFengler AlexanderFengler changed the title skip tests for consistency testing Fix initval setters leading to NotImplementedError Aug 14, 2024
@AlexanderFengler AlexanderFengler marked this pull request as ready for review August 14, 2024 13:21
Copy link
Collaborator

@digicosmos86 digicosmos86 left a comment

Choose a reason for hiding this comment

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

Looks good! Just some minor comments.

BTW, looks like process_initvals in HSSM does not have docstrings. Can you fix that?

process_initvals: bool = True,

src/hssm/hssm.py Show resolved Hide resolved
src/hssm/hssm.py Show resolved Hide resolved
src/hssm/hssm.py Outdated
Comment on lines 2079 to 2081
if not isinstance(self._initvals, dict):
raise ValueError("self._initvals should not be a dictionary.")
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

self._initvals can only be of type dict right? It's initialized as a dict

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

most of these are just in response to mypy bugging me endlessly :D
will try to do a round of improvements. @digicosmos86

@AlexanderFengler AlexanderFengler merged commit bc92951 into main Aug 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NotImplementedError: Cannot convert models with non-default initial_values (PyMC)
2 participants