`fwb` transpiler: progress bar is one tick short when `simple = TRUE`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- r
- Ambito
- developer-experience, tooling
Direzione di ricerca
Ispeziona il codice generato in template_fwb_outer e template_fwb_FUN, iniziando da come .progressr_skip_count viene impostato e decrementato intorno alle chiamate alla statistica di fwb(). Verifica gli aggiornamenti dell'avanzamento rispetto alla versione di sviluppo e a fwb 0.6.0, incluso il comportamento dipendente dalla versione; il lavoro è completo quando la prima replica non viene persa e le versioni supportate producono esattamente R aggiornamenti quando il numero di repliche è noto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The fwb transpiler's skip count assumes fwb() calls statistic on unit weights
twice when simple = TRUE. In the current fwb development version it calls it once,
whatever simple is, so the wrapper swallows the first real bootstrap replicate's update
and the bar finishes one tick short of R. This might cause an issue once the development version is on CRAN, so I wanted to let you know before I submitted it.
template_fwb_outer sets:
.progressr_skip_count <- if (.progressr_simple) 2L else 1L
and template_fwb_FUN decrements that on each call before it starts ticking. The count is
the number of times fwb() calls statistic before the R replicates begin.
In fwb 0.6.0 and earlier, simple = TRUE did call statistic twice on unit weights: the
second call existed only to detect whether statistic had a random component, which
determined whether the bootstrap weights could later be recovered. The development version
recovers the weights from recorded RNG streams instead, so that detection became
unnecessary and the second call was removed. There is now exactly one unit-weight call in
both cases.
An unconditional
.progressr_skip_count <- 1L
is correct for the development version and for every release after it.
It would break fwb 0.6.0, though: simple = TRUE there would leave the second
unit-weight call to be counted as a tick, giving R + 1 updates against a progressor with
R steps. So if you want to keep 0.6.0 working, this needs a version test:
.progressr_skip_count <- if (.progressr_simple &&
utils::packageVersion("fwb") <= "0.6.0") 2L else 1L
Note that an unconditional skip count also removes the need to infer simple,
which the template currently does by reproducing fwb()'s default rule:
.progressr_simple <- if (is.null(SIMPLE)) WTYPE != "multinom" else SIMPLE
With a constant skip count, SIMPLE and WTYPE are not needed at all.
Related, separate: R is not always the number of replicates
Worth flagging while you're in this code, since it also makes .progressr_steps wrong.
The development version adds an exhaustive multinomial bootstrap: because there are only
n^n distinct multinomial resamples of n units, when R reaches that many fwb() uses
each exactly once and reduces R to that number. The transpiler takes steps from the
R in the call, so the bar stalls partway.
Only reachable for very small n (n = 6 already has 46656 resamples, so with the default
R = 999 nothing above n = 4 is affected), and fwb() emits a message saying it has done
this. There may be nothing worth doing about it since the number of replicates isn't knowable
from the call alone, so a transpiler arguably cannot get this right in general. Recording it
rather than proposing a fix. Sorry to add this complication.
(Note: I used Claude Code to help with these edits and this issue.)
- Lingua principale
- R
- Stelle
- 4
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 futureverse/progressify
-
Add support for for-loops Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
Tutte le issue di futureverse/progressify
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
easystats/performance#950 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
briandconnelly/airnow#9 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
OHDSI/CohortConstructor#774 ·