Each sweep updates every weight, then moves every atom within its own part.
The support never changes size; only fw_step() or lb_step() add atoms.
Arguments
- state
A ripr_state.
- times
Steps to take.
- record_gap
Sweep the Frank–Wolfe oracle over the produced mixture, filling
gap_afterand caching it forgap_below()andfw_step(). Off by default: a full oracle sweep per row.- until
Optional predicate
function(state, candidate)tested before each step; see predicates.
Value
The updated ripr_state.
Examples
set.seed(1)
fam <- multinomial_family(n_trials = 4L, k = 3L)
plurality <- null_model(
fam,
list(
simplex_region(vertices = rbind(c(0.5, 0.5, 0), c(0, 1, 0), c(0, 0, 1))),
simplex_region(vertices = rbind(c(0.5, 0, 0.5), c(0, 1, 0), c(0, 0, 1)))
)
)
Q <- fam(c(0.4, 0.35, 0.25))
state <- ripr_init(Q, plurality) |> fw_step(times = 3L) |> em_step(times = 10L)
state@trace$kl
#> [1] 0.024511510 0.016814201 0.016233235 0.014378214 0.011977095 0.010831922
#> [7] 0.010065905 0.009486985 0.009018320 0.008622740 0.008280092 0.007978194
#> [13] 0.007708945 0.007466560