paired_sampler function

Sampling Paired Observations

Sampling Paired Observations

A sampler used to samples the batches where each instances is sampled twice

paired_sampler(vaeac_dataset_object, shuffle = FALSE)

Arguments

  • vaeac_dataset_object: A vaeac_dataset() object containing the data.
  • shuffle: Boolean. If TRUE, then the data is shuffled. If FALSE, then the data is returned in chronological order.

Details

A sampler object that allows for paired sampling by always including each observation from the vaeac_dataset() twice. A torch::sampler() object can be used with torch::dataloader() when creating batches from a torch dataset torch::dataset(). See https://rdrr.io/cran/torch/src/R/utils-data-sampler.R for more information. This function does not use batch iterators, which might increase the speed.

Author(s)

Lars Henry Berge Olsen