TuringLang / ParetoSmooth.jl

An implementation of PSIS algorithms in Julia.
http://turinglang.org/ParetoSmooth.jl/
MIT License
19 stars 12 forks source link

Add `psis!` method for in-place smoothing #43

Closed sethaxen closed 2 years ago

sethaxen commented 2 years ago

It wouldn't be completely allocation-free, as some allocations are needed (e.g. to compute profile log-likelihood), but it would at least cut down on the biggest allocation; a copy of log ratios.

ParadaCarleton commented 2 years ago

Makes sense, will do.

sethaxen commented 2 years ago

I see that https://github.com/TuringLang/ParetoSmooth.jl/commit/698bb94c8cb0850b4a8861bbef6d17296e50b888 renamed do_psis_i! to psis!, but it only operates on vectors and does none of the checks. My thinking RE psis! was to have the same functionality as psis (including performing checks) but just do so while overwriting the provided log ratios. This psis! could be basically the same as the current psis, and psis would then be reimplemented as just allocating the new output vector and then calling psis!. See for example how PSIS.jl does it.

An orthogonal issue is check handling. e.g., an keyword like checks=true could be provided to psis and psis! thst could be set to false to disable all checks

ParadaCarleton commented 2 years ago

Done!