-
Notifications
You must be signed in to change notification settings - Fork 107
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
Deprecate the "class" approach to the high-level kernels #492
Comments
Breaking: French dev propose to demolish class. Joke aside, what is the proposal for high level API? Factory function that returns callables (init and step)? |
Yes. These classes currently serve no purpose other than proposing a shortcut to the lower-level step functions. Factory functions work just fine, and you can still import the lower level ones as e.g. |
So the idea would be for the user to do from blackjax import mcmc
state = mcmc.hmc.init(position)
step = mcmc.hmc.kernel()
new_state, info = step(rng_key, state, logdensity_fn, step_size, inverse_mass_matrix, num_integration_steps) instead of import blackjax
hmc = blackjax.hmc(logdensity_fn, step_size, inverse_mass_matrix, num_integration_steps)
state = hmc.init(position)
new_state, info = hmc.step(rng_key, state) or do we want to introduce another function that does what classes do now? Maybe in Also, this would work for VI, MCMC, SGMCMC, and SMC. But for adaptation algorithms we still need a higher level class or function that puts things together. |
I wasn't clear, you would still do: import blackjax
hmc = blackjax.hmc(logdensity_fn, step_size, inverse_mass_matrix, num_integration_steps)
state = hmc.init(position)
new_state, info = hmc.step(rng_key, state) except |
So basically Line 88 in 2f19d12
|
I see how having a class with a |
Great, thanks! Then we can start moving these constructors to their respective algorithm-class folder like we discussed. |
Notice that by replacing classes with functions we loose this alias: |
I'm fine with that |
This was introduced to be able to access the low-level step and init functions at the higher level. With hindsight this was neither necessary nor a good design, and it also makes documenting these high-level constructs more complicated. We should use functions instead, like we do for
window_adaptation
.The text was updated successfully, but these errors were encountered: