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
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
iidobservations or in #1446 #1482 to allow post-hoc prior/likelihood modifications. All of this willwrapthe original estimator, modify its output, and return a modified score.Yet for some methods like
GaussorPriorGuidewe 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:
Additionally the
samplemethod/params as keyword now becomes quite overloaded so it might make sense to introduce an new improved API i.e. as suggested in #1482 viaposterior.with_iid("$METHOD",...).sampleorposterior.with_guidance("$METHOD",...).sampleGoals
initmethod for the potential before sampling)