# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
BootstrapSampler
"""

__all__ = ["BootstrapSampler"]


from sklearn.base import TransformerMixin

from ...base_transform import BaseTransform
from ...internal.core.preprocessing.filter.bootstrapsampler import \
    BootstrapSampler as core
from ...internal.utils.utils import trace


class BootstrapSampler(core, BaseTransform, TransformerMixin):
    """

    Approximate bootstrap sampling using Poisson sampling.

    .. remarks::
        ``BootstrapSampler`` implements the `Poisson Sampling
        <https://en.wikipedia.org/wiki/Poisson_sampling>`_ for generating
        samples with replacement for large datasets. The number of occurences
        for each observation in the new sample follows Binormial(n, 1/n),
        where n is the number of observations in the origin data and the
        number of target samples to generate.
        With large sample size, the distribution converges to a Poisson(1)
        distribution. Therefore, we generate
        the number of occurence for each observation independently using
        Poisson generation.

    :param columns: see `Columns </nimbusml/concepts/columns>`_.

    :param complement: Whether this is the out-of-bag sample, that is, return
        all the rows that are not selected by the resampler.

    :param random_state: The random seed. If unspecified random state will be
        instead derived from the environment.

    :param shuffle_input: Whether we should attempt to shuffle the source data.
        By default on, but can be turned off for efficiency.

    :param pool_size: This parameter is used in the shuffling process. A pool
        of a given number of rows will be constructed from the first
       rows in the input cursor, and then, successively, the output cursor
        will yield one
       of these rows and replace it with another row from the input. It is
        used in the shuffling process.

    :param params: Additional arguments sent to compute engine.

    .. index:: transform, random

    Example:
       .. literalinclude:: /../nimbusml/examples/BootStrapSampler.py
              :language: python
    """

    @trace
    def __init__(
            self,
            complement=False,
            random_state=None,
            shuffle_input=True,
            pool_size=1000,
            columns=None,
            **params):

        if columns:
            params['columns'] = columns
        BaseTransform.__init__(self, **params)
        core.__init__(
            self,
            complement=complement,
            random_state=random_state,
            shuffle_input=shuffle_input,
            pool_size=pool_size,
            **params)
        self._columns = columns

    def get_params(self, deep=False):
        """
        Get the parameters for this operator.
        """
        return core.get_params(self)
