public interface Sampler
RandomAccessDataset
.
A Sampler
implementation returns an iterator of batches for the RandomAccessDataset
. Instead of returning the actual items, it returns the item indices.
Different samplers can have different ways of sampling such as sampling with or without
replacement.
Many of the samplers may also make use of Sampler.SubSampler
s which sample not in batches but
in individual data item indices.
Modifier and Type | Interface and Description |
---|---|
static interface |
Sampler.SubSampler
An interface that samples a single data item at a time.
|
Modifier and Type | Method and Description |
---|---|
int |
getBatchSize()
Returns the batch size of the
Sampler . |
java.util.Iterator<java.util.List<java.lang.Long>> |
sample(RandomAccessDataset dataset)
Fetches an iterator that iterates through the given
RandomAccessDataset in
mini-batches of indices. |
java.util.Iterator<java.util.List<java.lang.Long>> sample(RandomAccessDataset dataset)
RandomAccessDataset
in
mini-batches of indices.dataset
- the RandomAccessDataset
to sample fromRandomAccessDataset
in
mini-batches of indicesint getBatchSize()
Sampler
.Sampler
, -1 if batch size is not fixed