Model methods fail on a reloaded fit when the data was passed in memory
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start with the $save_object() and $init_model_methods() methods on the fit object, and with $save_data_file(), which the issue says is the only way the data survives. Reproduce by saving a fit whose data was passed as a list, reloading it in a new session, and calling $log_prob(). Done means the model methods compile on the reloaded fit when data is supplied to $init_model_methods(), and the existing save/reload tests still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A fit created with data = list(...), saved with $save_object() and reloaded in a new R session compiles the model methods and then errors:
# session 1
fit <- cmdstanr_example("logistic")
fit$save_object("fit.rds")
# session 2
fit <- readRDS("fit.rds")
fit$log_prob(rep(0, 4))
#> Error : Error in JSON parsing
#> at offset 0:
#> The document is empty.
The fitted model object only stores the path to the JSON file CmdStanR wrote in the first session's tempdir, and $save_object() reads in the draws and diagnostics but not the data (on purpose since data files can be very large). This means that in the new session the path points nowhere unless the user had previously called fit$save_data_file() before the end of the initial session.
Instead of storing the data in the fit (we want to avoid this), we can add a data argument to $init_model_methods() for the cases when it's needed.
- Lingua principale
- R
- Stelle
- 164
- Fork
- 69
- Merge medio
- 1g 12h
- PR unite (30g)
- 49
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 stan-dev/cmdstanr
-
internal-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
stan-dev/cmdstanr#506 · 7 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
internal-code
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
stan-dev/cmdstanr#1314 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
stan-dev/cmdstanr#1175 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
CmdStanR 1.0 releaseAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
stan-dev/cmdstanr#1059 · 8 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di stan-dev/cmdstanr
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cran-task-views/Survival#76 ·
-
Package proposal: EDIAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
cran-task-views/Agriculture#146 ·
-
Package proposal: EDIAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
datacarpentry/semester-biology#1290 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OHDSI/CohortConstructor#776 ·