Pedantic warning for unnormalized densities inside log_mix and log_sum_exp
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- ocaml
- Ambito
- compilers
Direzione di ricerca
Start by reading the pedantic warning checks in the Stan compiler and the existing tests for --warn-pedantic; the issue does not name specific files or tests. Add coverage for _lupdf and _lupmf calls used directly or inside expressions passed to log_mix and log_sum_exp, including same-distribution components with differing data and parameter arguments. Done means those cases produce warnings while the stated parameter-dependent ~ case remains out of scope.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary:
The pedantic-mode could include a warning for an _lupdf or _lupmf call that is an argument of log_mix or log_sum_exp. The unnormalized densities of different distributions drop different constants, and the mixture then may have the wrong mixing proportions.
Description:
This program compiles without a warning, also with --warn-pedantic (stanc3 v2.40.0):
data {
real y;
}
parameters {
real mu;
real<lower=0> sigma;
real<lower=0, upper=1> lambda;
}
model {
target += log_mix(lambda,
normal_lupdf(y | mu, sigma),
cauchy_lupdf(y | mu, sigma));
}
normal_lupdf drops -log(sqrt(2 * pi)) and cauchy_lupdf drops -log(pi), so the effective mixing proportion differs from lambda. With normal_lpdf and cauchy_lpdf the program is correct. The same happens with log_sum_exp, and also with two components of the same distribution if an argument is data in one component and a parameter in the other.
The docs describe this case (stan-dev/docs#998, for stan-dev/docs#588). A warning would also find it in existing programs.
Proposed rule: warn when a call to an _lupdf or _lupmf function is a direct argument of log_mix or log_sum_exp, or appears in an expression that is a direct argument, for example log(theta) + normal_lupdf(...). The check can ignore whether the components drop the same terms.
This request does not cover the similar case where a condition that depends on parameters selects between ~ statements with different distributions. That case is harder to detect.
Current Version:
v2.40.0
- Lingua principale
- OCaml
- Stelle
- 162
- Fork
- 60
- Merge medio
- 2g 22h
- PR unite (30g)
- 14
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stan-dev/stanc3
-
optimization performance robustness
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
stan-dev/stanc3#1761 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
cleanup help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
-
cpp-codegen feature performance
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
stan-dev/stanc3#1722 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
feature optimization
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
I maintainer di solito rispondono entro 1 giorno
-
optimization
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
stan-dev/stanc3#1705 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di stan-dev/stanc3
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
-
mlir
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
llvm/llvm-project#241070 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
from-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug scope:codegen
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug sev-3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100