aleximmer / Laplace

Laplace approximations for Deep Learning.
https://aleximmer.github.io/Laplace
MIT License
472 stars 73 forks source link

Functional samples #243

Closed wiseodd closed 1 hour ago

wiseodd commented 2 months ago

Closes #241.

Use case: computation of an arbitrary expectation w.r.t. $p(f(x) \mid x, \mathcal{D})$.

wiseodd commented 2 months ago

I guess one small potential downside is that in this case you can't use call with another link function. Maybe this is even a good thing since using functional_samples is a lot more explicit than yet another argument to call

I agree with your last statement.

I believe the original semantic for __call__ is "making predictions based on the posterior obtained via __fit__". So, I'd say having an option in __call__ to do an arbitrary expectation is ill-suited. Esp. so since we don't support an arbitrary loss function for computing the Hessian.

wiseodd commented 2 days ago

@aleximmer could you please double-check and merge?