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

__all__ = ["CountSelector"]


from sklearn.base import TransformerMixin

from ..base_transform import BaseTransform
from ..internal.core.feature_selection.countselector import \
    CountSelector as core
from ..internal.utils.utils import trace


class CountSelector(core, BaseTransform, TransformerMixin):
    """
    Selects the features for which the count of non-default values is
    greater than or equal to a threshold.

    .. remarks::
        When using the count mode in feature selection transform, a feature
        is
        selected if the number of examples have at least the specified count
        examples of non-default values in the feature. The count mode feature
        selection transform is very useful when applied together with a
        categorical
        hash transform (see also, :py:class:`OneHotHashVectorizer
        <nimbusml.feature_extraction.categorical.OneHotHashVectorizer>` ). The
        count feature
        selection can remove those features generated by hash transform that
        have no
        data in the examples.

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

    :param count: The threshold for count based feature selection. A feature
        is
        selected if and only if at least ``count`` examples have non-default
        value in the feature. The default value is 1.

    :param params: Additional arguments sent to compute engine.

    .. seealso::
        :py:class:`mutualinformation_select
        <nimbusml.feature_selection.MutualInformationSelector>`

    .. index:: feature, selection, count

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

    @trace
    def __init__(
            self,
            count=1,
            columns=None,
            **params):

        if columns:
            params['columns'] = columns
        BaseTransform.__init__(self, **params)
        core.__init__(
            self,
            count=count,
            **params)
        self._columns = columns

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