import math


def _selection_size_heuristic(num_samples):
    """Return size of mini-batch, given size of dataset."""
    # Incrase size of mini-batch gradually as number of samples increases,
    # with a soft cap (using log).
    # But do not return size larger than number of samples
    return min(num_samples,
               int(20.0 *
                   (math.log(num_samples + 10, 2) - math.log(10.0) + 1.0)))