Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Detect non-finite `log_lik` (`Inf` / `NaN`) and explicitely inform the user

未关闭
#386 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
r
领域
data

调研方向

从 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

stan-dev/loo 的其他 Issue

查看 stan-dev/loo 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。