Make `unflatten!!` return an `AbstractInitStrategy`
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
- 30/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- julia
- Ambito
- backend-api-design
Direzione di ricerca
Inizia confrontando i percorsi slowLDF e fastLDF e tracciando gli utilizzi di unflatten!!, InitFromParams e init!!. Esamina poi come VectorValueAccumulator e OnlyAccsVarInfo si inseriscono nell’API proposta; il lavoro è completato quando unflatten!! restituisce un AbstractInitStrategy che può essere passato a init!! senza richiedere un VarInfo costruito ex novo né lasciare i transforms obsoleti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I think unflatten is the single thing that I've complained about the most and I would dearly like to remove all need for this function ever again.
I've thought about this a fair amount and there are a few blockers to this, specifically, Gibbs (https://github.com/TuringLang/Turing.jl/issues/2764). However, a very positive intermediate step would be to make unflatten!! return a new AbstractInitStrategy instead of a new VarInfo.
If you look at the difference between old slow LDF and new fast LDF, it mostly boils down to:
- slowLDF used
unflatten+evaluate!!on a VarInfo; - fastLDF constructs an
InitFromParams{<:VectorWithRanges}, that is semantically equal to a VarInfo whose contents have been replaced with the vector, but avoids actually using a VarInfo
I think this idea can be extended more broadly to also work with generic VarInfo. Essentially, unflatten!! would probably return exactly the same InitFromParams{<:VectorWithRanges} object that the LDF constructs. We could probably even share some code.
If you REALLY want a new VarInfo with those values, simple! Just do this
new_init_strategy = unflatten!!(varinfo, vec)
_, new_varinfo = init!!(model, varinfo, new_init_strategy)
The second line will overwrite everything inside the old varinfo. It will also cause the transforms to be updated, so there is no risk of having out of date transforms, which is my current number one gripe with unflatten!!.
Essentially, the above would replace the current workflow of
new_varinfo = unflatten!!(varinfo, vec)
# If you forget to do this (e.g. because you want to avoid the cost
# of reevaluating) and just use new_varinfo directly...... maybe in
# a subsequent MCMC step or in a different function ....... Oops!!!!
_, new_varinfo = evaluate!!(model, new_varinfo)
However, returning an AbstractInitStrategy is also more versatile. You can use it with an OnlyAccsVarInfo. You can use it with a LogDensityFunction (once I've reimplemented #1232, which is not difficult). It doesn't tie you into using a full VarInfo.
In fact, unflatten!! doesn't need a full VarInfo either -- it only needs a VectorValueAccumulator. That would be the next logical step after the above. What this means is that, any function who uses unflatten!! would be responsible upfront for making sure that there is a VectorValueAccumulator somewhere that it can use.
new_init_strategy = unflatten!!(vector_value_acc, vec)
- 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