sk_splitters ========================================================== .. py:module:: evalml.preprocessing.data_splitters.sk_splitters .. autoapi-nested-parse:: SKLearn data splitter wrapper classes. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.preprocessing.data_splitters.sk_splitters.KFold evalml.preprocessing.data_splitters.sk_splitters.StratifiedKFold Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: KFold(n_splits=5, *, shuffle=False, random_state=None) Wrapper class for sklearn's KFold splitter. **Methods** .. autoapisummary:: :nosignatures: evalml.preprocessing.data_splitters.sk_splitters.KFold.get_metadata_routing evalml.preprocessing.data_splitters.sk_splitters.KFold.get_n_splits evalml.preprocessing.data_splitters.sk_splitters.KFold.is_cv evalml.preprocessing.data_splitters.sk_splitters.KFold.split .. py:method:: get_metadata_routing(self) Get metadata routing of this object. Please check :ref:`User Guide ` on how the routing mechanism works. :returns: **routing** -- A :class:`~sklearn.utils.metadata_routing.MetadataRequest` encapsulating routing information. :rtype: MetadataRequest .. py:method:: get_n_splits(self, X=None, y=None, groups=None) Returns the number of splitting iterations in the cross-validator :param X: Always ignored, exists for compatibility. :type X: object :param y: Always ignored, exists for compatibility. :type y: object :param groups: Always ignored, exists for compatibility. :type groups: object :returns: **n_splits** -- Returns the number of splitting iterations in the cross-validator. :rtype: int .. py:method:: is_cv(self) :property: Returns whether or not the data splitter is a cross-validation data splitter. :returns: If the splitter is a cross-validation data splitter :rtype: bool .. py:method:: split(self, X, y=None, groups=None) Generate indices to split data into training and test set. :param X: Training data, where `n_samples` is the number of samples and `n_features` is the number of features. :type X: array-like of shape (n_samples, n_features) :param y: The target variable for supervised learning problems. :type y: array-like of shape (n_samples,), default=None :param groups: Group labels for the samples used while splitting the dataset into train/test set. :type groups: array-like of shape (n_samples,), default=None :Yields: * **train** (*ndarray*) -- The training set indices for that split. * **test** (*ndarray*) -- The testing set indices for that split. .. py:class:: StratifiedKFold(n_splits=5, *, shuffle=False, random_state=None) Wrapper class for sklearn's Stratified KFold splitter. **Methods** .. autoapisummary:: :nosignatures: evalml.preprocessing.data_splitters.sk_splitters.StratifiedKFold.get_metadata_routing evalml.preprocessing.data_splitters.sk_splitters.StratifiedKFold.get_n_splits evalml.preprocessing.data_splitters.sk_splitters.StratifiedKFold.is_cv evalml.preprocessing.data_splitters.sk_splitters.StratifiedKFold.split .. py:method:: get_metadata_routing(self) Get metadata routing of this object. Please check :ref:`User Guide ` on how the routing mechanism works. :returns: **routing** -- A :class:`~sklearn.utils.metadata_routing.MetadataRequest` encapsulating routing information. :rtype: MetadataRequest .. py:method:: get_n_splits(self, X=None, y=None, groups=None) Returns the number of splitting iterations in the cross-validator :param X: Always ignored, exists for compatibility. :type X: object :param y: Always ignored, exists for compatibility. :type y: object :param groups: Always ignored, exists for compatibility. :type groups: object :returns: **n_splits** -- Returns the number of splitting iterations in the cross-validator. :rtype: int .. py:method:: is_cv(self) :property: Returns whether or not the data splitter is a cross-validation data splitter. :returns: If the splitter is a cross-validation data splitter :rtype: bool .. py:method:: split(self, X, y, groups=None) Generate indices to split data into training and test set. :param X: Training data, where `n_samples` is the number of samples and `n_features` is the number of features. Note that providing ``y`` is sufficient to generate the splits and hence ``np.zeros(n_samples)`` may be used as a placeholder for ``X`` instead of actual training data. :type X: array-like of shape (n_samples, n_features) :param y: The target variable for supervised learning problems. Stratification is done based on the y labels. :type y: array-like of shape (n_samples,) :param groups: Always ignored, exists for compatibility. :type groups: object :Yields: * **train** (*ndarray*) -- The training set indices for that split. * **test** (*ndarray*) -- The testing set indices for that split. .. rubric:: Notes Randomized CV splitters may return different results for each call of split. You can make the results identical by setting `random_state` to an integer.