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

parameter behavior during Prior.constrain #1015

Closed
wd60622 opened this issue Sep 10, 2024 · 8 comments
Closed

parameter behavior during Prior.constrain #1015

wd60622 opened this issue Sep 10, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@wd60622
Copy link
Contributor

wd60622 commented Sep 10, 2024

Seems to be upstream from the preliz.maxent. Is there a version restriction required?

# Works
Prior("Normal").constrain(lower=-2, upper=2)
Prior("Normal", mu=0).constrain(lower=-2, upper=2)
# Doesn't work
Prior("Normal", mu=0, sigma=1).constrain(lower=-2, upper=2)

Think there was a change of behavior, the previous parameters acted as the initial points

@juanitorduz
Copy link
Collaborator

We should add a test :)

@juanitorduz juanitorduz added the bug Something isn't working label Sep 10, 2024
@wd60622 wd60622 changed the title Prior.constrain doesn't work with preliz.maxent parameter behavior during Prior.constrain Sep 10, 2024
@wd60622
Copy link
Contributor Author

wd60622 commented Sep 10, 2024

We should add a test :)

Not documented anywhere either. Do you have any thoughts on behavior? We can go with whatever is most intuitive

@aloctavodia
Copy link
Contributor

PreliZ's maxent does not need the user to specify an initial guess.
The parameters that you pass to Prior are considered fixed parameters, not initial guesses. In the last example both parameters mu and sigma are fixed, with nothing left there to optimize.

This behaviour is documented in the docstring for constrain and in this notebook https://github.com/pymc-labs/pymc-marketing/blob/main/docs/source/notebooks/general/model_configuration.ipynb

@wd60622
Copy link
Contributor Author

wd60622 commented Sep 10, 2024

PreliZ's maxent does not need the user to specify an initial guess. The parameters that you pass to Prior are considered fixed parameters, not initial guesses. In the last example both parameters mu and sigma are fixed, with nothing left there to optimize.

This behaviour is documented in the docstring for constrain and in this notebook https://github.com/pymc-labs/pymc-marketing/blob/main/docs/source/notebooks/general/model_configuration.ipynb

Ah, was looking in the docstring. Would be good to add there or clarify in one of existing examples there

The current error is pretty cryptic. Maybe a good check to add to the preliz

BTW. Didn't know about that prior explorer linked. Very cool

@aloctavodia
Copy link
Contributor

It is already in the docsring https://github.com/pymc-labs/pymc-marketing/blob/main/pymc_marketing/prior.py#L772-L780.

Thanks for the kind comment about prior explorer, it still needs some polishing, but I already find it useful.

@aloctavodia
Copy link
Contributor

PreliZ will raise an error if the distribution passed to maxent is frozen, see arviz-devs/preliz#534

@aloctavodia
Copy link
Contributor

PreliZ 0.9.1 has been released. Thanks for offering feedback about PreliZ.

@wd60622
Copy link
Contributor Author

wd60622 commented Sep 10, 2024

Oh, nice. Thank you for quick adjustments. Will close this for now then

@wd60622 wd60622 closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants