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

Domain violation in transform #55

Open
andreasnoack opened this issue Sep 25, 2019 · 6 comments
Open

Domain violation in transform #55

andreasnoack opened this issue Sep 25, 2019 · 6 comments

Comments

@andreasnoack
Copy link
Contributor

E.g.

julia> t = as((σ = asℝ₊,));

julia> transform(t, [-746])
(σ = 0.0,)

This is causing problems in some optimization code where we optimize over the Vector representation and have to convert back and forth. That causes errors similar to

julia> inverse(t, transform(t, [-746]))
ERROR: DomainError with x > shift must hold. Got
x => 0.0
shift => 0.0:
@tpapp
Copy link
Owner

tpapp commented Sep 25, 2019

I wonder if a less strict domain checking (allow 0, map it to -Inf) would solve this.

@andreasnoack
Copy link
Contributor Author

Possibly. After filing the issue, I thought a bit more about the problem and I'm not sure what the right solution is. My problem clear wants to set σ to zero so the problem might just move somewhere else if this issue is fixed one way or the other.

@tpapp
Copy link
Owner

tpapp commented Sep 25, 2019

Can you please provide more context?

Eg in a Bayesian model if there is mass around σ = 0 (and it is some kind of a standard deviation/scale parameter) then I would suspect a misspecified model, or try to keep it away from zero with a prior. I am not saying that your model is wrong in this way but the solution can be context-dependent.

@andreasnoack
Copy link
Contributor Author

It's traditional maximum likelihood optimization and most likely the model that triggered this is wrong. However, people will try to fit wrong models it's a matter of failing in a reasonable way.

@tpapp
Copy link
Owner

tpapp commented Sep 25, 2019

I am very happy to fix this issue, I just need help with what you or other users would consider reasonable.

Personally, since an invariant is violated, I prefer failure so that I can learn about it early and investigate.

Eg for ML, I would do penalized ML/MAP. Is it a hierarchical model?

@andreasnoack
Copy link
Contributor Author

I am very happy to fix this issue, I just need help with what you or other users would consider reasonable.

I understand

Personally, since an invariant is violated

Yes but the invariant is violated already in

julia> transform(t, [-746])
(σ = 0.0,)

so that might be where the exception should be thrown from.

Is it a hierarchical model?

Yes indeed it's a hierarchical model. What we are planning to try out is to use constraints instead of transformations for ML. The optimization folks tell us that it is much better. We'll continue to use transformations for Bayesian but the issue here will probably not show up there.

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

No branches or pull requests

2 participants