Inconsistent Pareto k-values for SIS?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Reproduce el ejemplo con psis(), sis(), weights() y pareto_k_values() usando example_loglik_array() y el r_eff mostrado. Compara los valores Inf del fallback de SIS con los resultados explícitos de SIS, luego determina el comportamiento previsto de los valores k de Pareto y cubre el resultado acordado con una prueba de regresión.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I noticed that there might be an inconsistency in the Pareto k-values between different approaches for standard importance sampling (SIS):
library(loo)
log_ratios <- -1 * example_loglik_array()
log_ratios <- log_ratios[1:3, , ]
r_eff <- relative_eff(exp(-log_ratios))
# Call psis():
psis_result <- psis(log_ratios, r_eff = r_eff)
# In fact, SIS was used (due to the small number of draws):
lw_sis <- apply(log_ratios, 3, as.vector)
lw_sis <- sweep(lw_sis, 2, apply(lw_sis, 2, matrixStats::logSumExp))
stopifnot(all.equal(weights(psis_result), lw_sis,
tolerance = .Machine$double.eps))
# Now request SIS explicitly:
sis_result <- sis(log_ratios, r_eff = r_eff)
# The (log) weights are as expected:
stopifnot(all.equal(weights(sis_result), lw_sis,
tolerance = .Machine$double.eps))
# However:
table(pareto_k_values(psis_result))
## Inf
## 32
table(pareto_k_values(sis_result))
## 0
## 32
The point is that calling psis() with a small number of draws will cause the Pareto smoothing not to take place. Instead, SIS is used, as demonstrated above. In that case, the Pareto k-values are Inf. When using sis() explicitly, the Pareto k-values are 0.
Background: In projpred, it is possible (although not encouraged and in particular, this is not the default behavior) to use PSIS-LOO CV with the search being excluded from the CV (validate_search = FALSE) and a small number of thinned draws. In principle, projpred could use sis() explicitly in such a case (and then either continue with the Pareto k-values which are all 0 or even skip the Pareto k checks), but that requires to catch the "small S" case manually (which is not a problem, but if loo changes anything in its "small S" decision rule in the future, this would require adapting projpred's decision rule analogously). Using psis() would be more straightforward, but then we have Pareto k-values which are Inf, which would trigger warnings in the Pareto k checks.
- Lenguaje dominante
- R
- Estrellas
- 157
- Forks
- 38
- Merge medio
- 4 d 16 h
- PR fusionados (30 d)
- 2
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de stan-dev/loo
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Extend loo_plot_difference Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
-
Clean up issues Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Todos los issues de stan-dev/loo
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
robjhyndman/forecast#1220 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
JamesHWade/deputy#192 ·
-
bug triage_needed
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pharmaverse/rtables#1123 · 1 comentario · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100