-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Update notebook examples with new variational API #2097
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
Conversation
I found that normalizing loss can make convergence slower due to weaker gradients. I'll make it optional for user in a separate PR |
Previous callback stopped earlier for hierarchical model when convergence was not achieved. The new one did not stop at all though(remark: it stopped once). |
Can you replace the |
Agreed. Moreover, the |
@fonnesbeck |
@ferrine Couldn't we store that in the returned object, like we did before? |
@twiecki good point, but I don't think that's bad api. Since 2 optimizers can be passed in the future, there will be 2 more kwarg |
@ferrine Not bad, but not user-friendly I would argue. Can we not pass in |
@twiecki ofc we can but ideologically they'd be better distinguished |
@ferrine not sure I follow, distinguished to what? |
I've said this before, but I feel pretty strongly about keeping the default interface consistent across fitting methods -- particularly in our examples. |
I think that approx, losses = pm.fit(...) What about optimizers. What about wrapping them in a classes? |
@ferrine Why wouldn't the loss be part of the approximation? To me it makes sense. I see now, I somehow thought we already used classes in updates.py, which is clearly wrong. So yes, turning optimizers into classes is the right approach here. |
@twiecki Approximation purpose is to store parameters and allow sampling. Inference purpose is to fit the approx. These two tasks differ a lot. The right design is to make objects serve one particular thing. Mixing inference with approximation violates this idea. |
@ferrine I think the loss history of an approximation can be coherently included in the approximation class. I do see your point, but the API trumps code purity in my opinion. I love the |
Can I introduce a lightweight wrapper over results so that they store both approximation and stats? |
@ferrine Definitely, how would you do that on a high level? |
I'll try. High level is needed. I always write some weird callbacks to have custom watch list of statistics. Adding |
Sounds good. FWIW callbacks are usually frowned upon, look for callback hell. |
Rebased |
Solved by #2171 |
Moving to new variational API, linked with #1968