Closed mschauer closed 2 years ago
PSIS fits a GPD distribution d
to the extreme right tail of the log-weights (input values), and then replaces those values by uniformly-spaced quantiles from d
. The location parameter of the GPD is set to the largest value not in the tail, so yes, it should be monotonically increasing.
e.g. a comparison with PSIS.jl:
using PSIS, ParetoSmooth
M = collect(0:0.01:1.0).^10
M2 = copy(M)
ParetoSmooth.psis!(M2)
M3 = copy(M)
PSIS.psis!(M3)
plot([M M2 M3]; legend=:topleft, label=["input" "ParetoSmooth" "PSIS"], xlims=(50, Inf), alpha=0.75)
PSIS.jl and ParetoSmooth use the same algorithm, so to me this looks like a bug.
The thing I find is that signature changed from the help, the following is outdated
help?> psis!
search: psis! pushfirst! psis Psis psis_loo psis_ess PsisLoo PSIS
psis!(is_ratios::AbstractVector{<:Real}; tail_length::Integer, log_ratios=false) -> Real
and we should use log_ratios=false
because the default is now true
Then
using PSIS, ParetoSmooth
M = collect(0:0.01:1.0).^10
M2 = copy(M)
ParetoSmooth.psis!(M2, log_weights=false)
M3 = log.(M)
PSIS.psis!(M3)
plot([M M2 exp.(M3)]; legend=:topleft, linestyle=[:solid :dash :solid], label=["input" "ParetoSmooth" "PSIS"], color=[:blue :green :yellow], xlims=(50, Inf))
So this is a error in the docs
~Ah, yes, the documentation defines log_weights
as the opposite of what the code does.~
nevermind
Thanks for catching that error in the docs :sweat_smile:
I observed that when smoothing a tail
the tail is not monotone increasing, as I would expect it to be. Isn't it constructed as sequence of quantiles?