Corner case in `dirichlet_lpdf`: error when both alpha - 1 = theta = 0
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- cpp
- Bereich
- machine-learning
Rechercherichtung
Beginnen Sie in stan/math/prim/prob/dirichlet_lpdf.hpp bei der verlinkten theta_log-Berechnung und untersuchen Sie anschließend die entsprechende Handhabung von partials_vec<1>. Bestimmen Sie, ob der Fall alpha - 1 = theta = 0 ohne einen Fehler zu erzeugen null beitragen sollte, und stellen Sie sicher, dass sich das zugehörige autodiff-Verhalten konsistent verhält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
In the code there is currently:
const auto& theta_log
= to_ref_if<!is_constant_all<T_prior_size>::value>(theta_dbl.log());
if (include_summand<propto, T_prob, T_prior_size>::value) {
lp += (theta_log * alpha_m_1).sum();
}
I understand that by the convention (and also by Stan documentation) for Dirichlet distribution, we usually require theta > 0. But when you think about it, for the corner case when alpha -1 == theta == 0, it is reasonable to define the lpdf to be 0 by the same logic why we define pow(0,0)=1. This is relevant in my application, where I may have on input an information that certain index of theta is a forbidden state and may thus be represented as hard constrained to be equal to 0, but then the Dirichlet prior crashes no matter what. This would be very inefficient for me to workaround by deleting the offending array element as I need to do this over a matrix with many rows each of which may have different constraints, so currently I needed to make my custom implementation of dirichlet_lpdf just to deal with that. I thus propose we change the code to something like:
if (include_summand<propto, T_prob, T_prior_size>::value) {
lp += lmultiply(alpha_m_1, theta).sum();
}
The partials_vec<1> may need a corresponding adjustment.
- Vorherrschende Sprache
- C++
- Sterne
- 845
- Forks
- 225
- Ø Merge
- 4 T. 21 Std.
- Gemergte PRs (30 T.)
- 13
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus stan-dev/math
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 54/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 54/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
numerics performance
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
stan-dev/math#3481 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
`eigendecompose_sym`, `eigenvalues_sym` and `eigenvectors_sym` do not compile for complex matrices of `fvar<var>` or `fvar<fvar<double>>`Evtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offenbug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
stan-dev/math#3477 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
ROCm/rocm-systems#15475 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
Sendspin/sendspin-cpp#257 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
pocoproject/poco#5664 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
community:good-first-issue kind:bug kind:test scope:control status:needs-triage vehicle:rover
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
PX4/PX4-Autopilot#29727 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag