Detect non-finite `log_lik` (`Inf` / `NaN`) and explicitely inform the user
还没有人认领这个 Issue。
评估
调研方向
从 loo::loo() 入口点开始,追踪 log_lik 矩阵在哪里进行验证,或在哪里传递给 PSIS-LOO。使用包含 +Inf 的可复现矩阵,验证非有限值会被明确报告,而不是静默地产生 NA 估计值。当面向用户的行为能够识别无效的 log_lik 值,并且现有示例不再在缺少该信息的情况下完成时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
If the pointwise log-likelihood matrix contains +Inf or NaN, loo::loo() currently completes without a clear error/warning and can return NA for elpd_loo.
Proposal
Before (or while) computing PSIS-LOO, check the log_lik matrix for non-finite values and message this clearly to the user.
Reproducible example
library(loo)
set.seed(1)
ll <- matrix(rnorm(400 * 20, -1, 0.5), 400, 20)
ll[1:5, 1] <- Inf
loo(ll)$estimates # elpd_loo is NA; no clear message that log_lik had +Inf
# Estimate SE
# elpd_loo NA NA
# p_loo NA NA
# looic NA NA
Context
Seen with truncated-normal log_lik from brms, where the truncation normalizer can underflow:
https://discourse.mc-stan.org/t/difficulty-adding-loo-criterion-to-longitudinal-truncated-normal-model/41447/12
Corresponding brms Issue: https://github.com/paul-buerkner/brms/issues/1899
- 主要语言
- R
- 星标
- 157
- 派生
- 38
- 平均合并
- 4 天 16 小时
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
stan-dev/loo 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 5/5 一周以上 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 68/100
-
Clean up issues 未关闭
难度 4/5 3-5 天 新手友好度 25/100
相似的 Issue
-
Affects Web App documentation PRIORITY LOW
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 80/100
hubverse-org/hubCI#36 ·
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Release 1.4.0 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
pharmaverse/pharmaverseadam#170 ·