Shuffles 0..n-1 once with the reference LCG Fisher-Yates, then slices
into consecutive batches of b. Returned indices are 0-based.
Usage
morie_geron_dataloader_minibatch(
n,
b,
shuffle = TRUE,
seed = 0,
drop_last = FALSE
)
Arguments
- n
Number of instances.
- b
Batch size in [1, n].
- shuffle
Logical; permute before slicing.
- seed
LCG seed.
- drop_last
Drop a short final batch.
Value
List with batches (list of 0-based index vectors),
n_batches, batch_sizes, permutation, covers_all.
Examples
morie_geron_dataloader_minibatch(n = 5L, b = 5L)
#> $batches
#> $batches[[1]]
#> [1] 0 3 2 4 1
#>
#>
#> $n_batches
#> [1] 1
#>
#> $batch_sizes
#> [1] 5
#>
#> $permutation
#> [1] 0 3 2 4 1
#>
#> $covers_all
#> [1] TRUE
#>
#> $drop_last
#> [1] FALSE
#>
#> $seed
#> [1] 0
#>
#> $n
#> [1] 5
#>