Repository: scikit-learn/scikit-learn
File: sklearn/preprocessing/_target_encoder.py (Python)

Code before:
        Determines the splitting strategy used in the internal :term:`cross fitting`
        during :meth:`fit_transform`. Splitters where each sample index doesn't appear
        in a validation fold exactly once, raise a `ValueError`.
        Possible inputs for cv are:

        - None, to use a 5-fold cross-validation chosen internally based on
            `target_type` and `groups`,
        - integer, to specify the number of folds for the cross-validation chosen
            internally based on `target_type`,
        - :term:`CV splitter` that does not repeat samples across test folds,
        - an iterable yielding (train, test) splits as arrays of indices.

        For integer/None inputs, if `target_type` is `"continuous"`, :class:`KFold` is
        used, otherwise :class:`StratifiedKFold` is used. After calling
        :meth:`fit_transform`, the `cv_` attribute stores the name of the
        cross-validation strategy used.

        Refer :ref:`User Guide <cross_validation>` for mor information on
        cross-validation strategies.

        .. versionchanged:: 1.9
            Cross-validation generators and iterables can also be passed as `cv`.

    shuffle : bool, default=True
        Whether to shuffle the data in :meth:`fit_transform` before splitting into
        folds. Note that the samples within each split will not be shuffled. Only
        applies if `cv` is an int or `None`. If `cv` is a cross-validation generator or
        an iterable, `shuffle` is ignored.

    random_state : int, RandomState instance or None, default=None
        When `shuffle` is True, `random_state` affects the ordering of the
        indices, which controls the randomness of each fold. Otherwise, this
        parameter has no effect.
        Pass an int for reproducible output across multiple function calls.
        See :term:`Glossary <random_state>`.

    Attributes
    ----------
    encodings_ : list of shape (n_features,) or (n_features * n_classes) of \
                    ndarray
        Encodings learnt on all of `X`.
        For feature `i`, `encodings_[i]` are the encodings matching the
        categories listed in `categories_[i]`. When `target_type_` is
        "multiclass", the encoding for feature `i` and class `j` is stored in
        `encodings_[j + (i * len(classes_))]`. E.g., for 2 features (f) and
        3 classes (c), encodings are ordered:
        f0_c0, f0_c1, f0_c2, f1_c0, f1_c1, f1_c2,

    categories_ : list of shape (n_features,) of ndarray
        The categories of each input feature determined during fitting or
        specified in `categories`

Review comment (suggestion):
now that users can pass an actual `cv`, this is redundant, so ideally I'd remove it, but I don't think we have to go through the deprecation and leave it here.

Code after:
        Determines the splitting strategy used in the internal :term:`cross fitting`
        during :meth:`fit_transform`. Splitters where each sample index doesn't appear
        in the validation fold exactly once, raise a `ValueError`.
        Possible inputs for cv are:

        - `None`, to use a 5-fold cross-validation chosen internally based on
            `target_type`,
        - integer, to specify the number of folds for the cross-validation chosen
            internally based on `target_type`,
        - :term:`CV splitter` that does not repeat samples across validation folds,
        - an iterable yielding (train, test) splits as arrays of indices.

        For integer/None inputs, if `target_type` is `"continuous"`, :class:`KFold` is
        used, otherwise :class:`StratifiedKFold` is used.

        Refer :ref:`User Guide <cross_validation>` for more information on
        cross-validation strategies.

        .. versionchanged:: 1.9
            Cross-validation generators and iterables can also be passed as `cv`.

    shuffle : bool, default=True
        Whether to shuffle the data in :meth:`fit_transform` before splitting into
        folds. Note that the samples within each split will not be shuffled. Only
        applies if `cv` is an int or `None`. If `cv` is a cross-validation generator or
        an iterable, `shuffle` is ignored.

    random_state : int, RandomState instance or None, default=None
        When `shuffle` is True, `random_state` affects the ordering of the
        indices, which controls the randomness of each fold. Otherwise, this
        parameter has no effect.
        Pass an int for reproducible output across multiple function calls.
        See :term:`Glossary <random_state>`.

    Attributes
    ----------
    encodings_ : list of shape (n_features,) or (n_features * n_classes) of \
                    ndarray
        Encodings learnt on all of `X`.
        For feature `i`, `encodings_[i]` are the encodings matching the
        categories listed in `categories_[i]`. When `target_type_` is
        "multiclass", the encoding for feature `i` and class `j` is stored in
        `encodings_[j + (i * len(classes_))]`. E.g., for 2 features (f) and
        3 classes (c), encodings are ordered:
        f0_c0, f0_c1, f0_c2, f1_c0, f1_c1, f1_c2,

    categories_ : list of shape (n_features,) of ndarray
        The categories of each input feature determined during fitting or
        specified in `categories`
        (in order of the features in `X` and corresponding with the output
        of :meth:`transform`).