Interface Sampler

All Known Implementing Classes:
BatchSampler

public interface Sampler
An interface for sampling data items from a 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.SubSamplers which sample not in batches but in individual data item indices.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    An interface that samples a single data item at a time.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the batch size of the Sampler.
    Fetches an iterator that iterates through the given RandomAccessDataset in mini-batches of indices.
  • Method Details

    • sample

      Fetches an iterator that iterates through the given RandomAccessDataset in mini-batches of indices.
      Parameters:
      dataset - the RandomAccessDataset to sample from
      Returns:
      an iterator that iterates through the given RandomAccessDataset in mini-batches of indices
    • getBatchSize

      int getBatchSize()
      Returns the batch size of the Sampler.
      Returns:
      the batch size of the Sampler, -1 if batch size is not fixed