-
Notifications
You must be signed in to change notification settings - Fork 239
Description
Refactor vector field potential to allow estimating hyperparameters once.
By now we have quite a few methods to post-hoc adapt the score/vf to allow iid observations or in #1446 #1482 to allow post-hoc prior/likelihood modifications. All of this will wrap the original estimator, modify its output, and return a modified score.
Yet for some methods like Gauss or PriorGuide we have to do some "nontrivial" preprocessing/hyperparameter optimization before one can start to sample. This is currently made possible via caching i.e. such that only the first call is delayed.
This works, but it is brittle:
- it hides expensive initialization behind the first evaluation,
- it makes execution order matter in subtle ways,
- and it couples correctness to correct cache behavior.
Additionally the sample method/params as keyword now becomes quite overloaded so it might make sense to introduce an new improved API i.e. as suggested in #1482 via posterior.with_iid("$METHOD",...).sample or posterior.with_guidance("$METHOD",...).sample
Goals
- Design an interface that separates setup / fitting from score evaluation (i.e. a
initmethod for the potential before sampling) - Allow wrapped estimators to run one-time preprocessing before sampling