# Path: batchup/sampling.py
# def num_batches(n, batch_size):
#     def num_indices_generated(self):
#     def map_indices(self, indices):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def __init__(self, length, repeats=1):
#     def num_indices_generated(self):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def __init__(self, indices, repeats=1):
#     def num_indices_generated(self):
#     def map_indices(self, indices):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def __init__(self, weights):
#     def num_indices_generated(self):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def class_balancing_sample_weights(y):
#     def class_balancing_sampler(y):
#     def __init__(self, sub_weights, indices):
#     def num_indices_generated(self):
#     def map_indices(self, indices):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def class_balancing_sampler(y, indices):
# class AbstractSampler (object):
# class StandardSampler (AbstractSampler):
# class SubsetSampler (AbstractSampler):
# class WeightedSampler (AbstractSampler):
# class WeightedSubsetSampler (AbstractSampler):


import six
import collections
import numpy as np
from batchup import sampling
        ...     return e.mean(axis=1)

        Now define a function that computes the *SUM* of the binary cross
        entropy losses over the sample axis (axis 0), as the default
        behaviour of `mean_batch_map` will sum them up and divide by the
        number of samples at the end:

        >>> def binary_crossentropy_loss_sum(pred, target):
        ...     return binary_crossentropy_loss(pred, target).sum()

        Construct prediction and target data

        >>> pred = np.random.uniform(0.0, 1.0, size=(15, 10))
        >>> tgt = np.random.uniform(0.0, 1.0, size=(15, 10))
        >>> ds = ArrayDataSource([pred, tgt])

        Apply the loss sum function defined above:

        >>> loss = ds.batch_map_mean(binary_crossentropy_loss_sum,
        ...                          batch_size=5)
        >>> assert np.allclose(
        ...     loss, binary_crossentropy_loss(pred, tgt).mean())
        """
        if n_batches is None:
            n = self.num_samples(**kwargs)
            if n == np.inf:
                raise ValueError('Data set has infinite size or sampler will '
                                 'generate infinite samples but no n_batches '
                                 'limit specified')
            elif n is not None:

# Path: batchup/sampling.py
# def num_batches(n, batch_size):
#     def num_indices_generated(self):
#     def map_indices(self, indices):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def __init__(self, length, repeats=1):
#     def num_indices_generated(self):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def __init__(self, indices, repeats=1):
#     def num_indices_generated(self):
#     def map_indices(self, indices):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def __init__(self, weights):
#     def num_indices_generated(self):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def class_balancing_sample_weights(y):
#     def class_balancing_sampler(y):
#     def __init__(self, sub_weights, indices):
#     def num_indices_generated(self):
#     def map_indices(self, indices):
#     def in_order_indices_batch_iterator(self, batch_size):
#     def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
#     def class_balancing_sampler(y, indices):
# class AbstractSampler (object):
# class StandardSampler (AbstractSampler):
# class SubsetSampler (AbstractSampler):
# class WeightedSampler (AbstractSampler):
# class WeightedSubsetSampler (AbstractSampler):


# Path: batchup/data_source.py
import six
import collections
import numpy as np
from batchup import sampling

        ...     return e.mean(axis=1)

        Now define a function that computes the *SUM* of the binary cross
        entropy losses over the sample axis (axis 0), as the default
        behaviour of `mean_batch_map` will sum them up and divide by the
        number of samples at the end:

        >>> def binary_crossentropy_loss_sum(pred, target):
        ...     return binary_crossentropy_loss(pred, target).sum()

        Construct prediction and target data

        >>> pred = np.random.uniform(0.0, 1.0, size=(15, 10))
        >>> tgt = np.random.uniform(0.0, 1.0, size=(15, 10))
        >>> ds = ArrayDataSource([pred, tgt])

        Apply the loss sum function defined above:

        >>> loss = ds.batch_map_mean(binary_crossentropy_loss_sum,
        ...                          batch_size=5)
        >>> assert np.allclose(
        ...     loss, binary_crossentropy_loss(pred, tgt).mean())
        """
        if n_batches is None:
            n = self.num_samples(**kwargs)
            if n == np.inf:
                raise ValueError('Data set has infinite size or sampler will '
                                 'generate infinite samples but no n_batches '
                                 'limit specified')
            elif n is not None:

                n_batches = sampling.num_batches(n, batch_size)