VNTs and submodels
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- julia
- Ambito
- machine-learning
Direzione di ricerca
Inizia tracciando to_submodel, tilde_observe!! e il percorso del compilatore per le variabili fisse descritto nell'issue. Il lavoro è completato quando i sottomodelli separano chiaramente i valori restituiti dalle variabili latenti, il condizionamento latente valido continua a funzionare e il condizionamento sul valore restituito o il passaggio del valore restituito viene rifiutato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
There is a nasty interaction here:
@model inner() = a ~ Normal()
@model function f()
x ~ to_submodel(inner())
end
model = f() | (@varname(x.a) => 2.0)
OK. In the past, what would happen is that the conditioned values would be stored as Dict(@varname(x.a) => 2.0). When we got to x ~ to_submodel(...), we check whether x was conditioned on. If so, we call tilde_observe!!, if not, we call tilde_assume!!.
tilde_observe!! on submodels used to error. The reason for this is because we want to avoid two scenarios:
- People thinking that they can condition the return value of the submodels, e.g.
model = f() | (@varname(x) => myretval). - People putting the return value of the submodel as a model argument, e.g.
@model function f(x) ... x ~ to_submodel(...).
Fundamentally this is because the return value of the submodel can't be conditioned on.
What's the problem now then?
Well, if conditioned values are stored as VNTs, then the problem is that VarNamedTuple(x = VarNamedTuple(a = 1)) DOES actually contain a value for x. The value for x is the inner VNT.
So when we check whether x is conditioned on, that returns true, and we go down tilde_observe!! and that errors.
In #1238 I changed tilde_observe!! to no longer error. I also put in a patch inside the compiler itself for fixed variables, which have their own code path. That is a hotfix for the current situation, however, it also means that the previous cases where we used to error now run fine. The current behaviour will be that the submodel will be evaluated as if the left-hand side was a completely new variable (i.e. everything is assumed). So, for example
@model function f2(x)
x ~ to_submodel(inner())
end
model = f2(3.0)
will behave exactly the same as model = f().
Fundamentally the reason why we have this problem is that we can't differentiate between the latent variables (which can be conditioned on) and the return value (which can't). There is not enough information to tell whether somebody wanted to condition on x.a (valid), or whether somebody wanted to condition on the return value x (invalid).
In contrast, if we had
retval, latent ~ to_submodel(inner())
then it would be trivial to error if somebody tried to condition on retval, but evaluate the submodel normally if somebody conditioned on latent.x.
I think, then, in the next version of DPPL, it's time to finally do this properly, enforce a separation between the retval and the latent variables, to avoid all this horrendous behaviour which is frankly 1.5 or 2 year old technical debt arising from the to_submodel change.
- Lingua principale
- Julia
- Stelle
- 291
- Fork
- 43
- Merge medio
- 1g 23h
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la 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 TuringLang/DynamicPPL.jl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
TuringLang/DynamicPPL.jl#1499 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
TuringLang/DynamicPPL.jl#1480 ·
I maintainer di solito rispondono entro 2 giorni
-
Separate model-evaluation inputs from outputsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertadata-structures enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
TuringLang/DynamicPPL.jl#1469 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
TuringLang/DynamicPPL.jl#1466 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
documentation
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
TuringLang/DynamicPPL.jl#1390 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di TuringLang/DynamicPPL.jl
Issue simili
-
Release CorleoneInverse as 0.1.1Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
SciML/Corleone.jl#200 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaAI/MLJTransforms.jl#120 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
exercism/julia#1205 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
SciML/OrdinaryDiffEq.jl#5175 ·
I maintainer di solito rispondono entro 1 giorno