Skip to content

[Bug] Initialize parameters complying with constraints if transform=None #629

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

Closed
Balandat opened this issue Apr 9, 2019 · 3 comments
Closed
Assignees
Labels

Comments

@Balandat
Copy link
Collaborator

Balandat commented Apr 9, 2019

🐛 Bug

When passing transform=None into constraints, constraints are not enforced via a transform. Yet the parameter initialization in most places sets initial values to zero, disregarding the constraint. E.g. if you pass noise_constraint=GreaterThan(1e-4, transform=None into the GaussianLikelihood, then the initial value of the noise is 0. This usually results in nan errors in the first step of fitting. You can manually set the initial value to something more reasonable, but it's kind of cumbersome to have to do that manually every time when instantiating a model.

Expected Behavior

If a non-enforced constraint is present, the initial value should be chosen in compliance with the constraint in some reasonable fashion, e.g. as the mid point of an Interval constraint, or as 2*lower_bound for a GreaterThan constraint.

@Balandat Balandat added the bug label Apr 9, 2019
@jacobrgardner
Copy link
Member

Let's add an inital_value method to constraints and then use it in our modules (e.g. Kernel) after registering? I don't think we should have register_constraint modify parameter values, or it could lead to gotchas if people set custom initial values before registering constraints (a perfectly reasonable workflow if they haven't used the model yet).

@Balandat
Copy link
Collaborator Author

Balandat commented Apr 9, 2019

Another thing that would make a lot of sense is to initialize parameters from the mean/mode of the prior (if present). Not sure if we should handle this internally though or whether that's sufficiently advanced a use case that it can be done manually.

@Balandat Balandat self-assigned this Apr 12, 2019
Balandat added a commit that referenced this issue Apr 12, 2019
This simplifies intializing parameters from a constraint object.
Addresses #629
@gpleiss
Copy link
Member

gpleiss commented May 2, 2019

I think this was closed by #643 ? (Reopen if not!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants