MCPcopy Create free account
hub / github.com/scikit-learn/scikit-learn / split

Method split

sklearn/model_selection/_split.py:1420–1444  ·  view source on GitHub ↗

Generate indices to split data into training and test set. Parameters ---------- X : array-like of shape (n_samples, n_features) Training data, where `n_samples` is the number of samples and `n_features` is the number of features. y : array-l

(self, X, y=None, groups=None)

Source from the content-addressed store, hash-verified

1418 return len(np.unique(groups))
1419
1420 def split(self, X, y=None, groups=None):
1421 """Generate indices to split data into training and test set.
1422
1423 Parameters
1424 ----------
1425 X : array-like of shape (n_samples, n_features)
1426 Training data, where `n_samples` is the number of samples
1427 and `n_features` is the number of features.
1428
1429 y : array-like of shape (n_samples,), default=None
1430 The target variable for supervised learning problems.
1431
1432 groups : array-like of shape (n_samples,)
1433 Group labels for the samples used while splitting the dataset into
1434 train/test set.
1435
1436 Yields
1437 ------
1438 train : ndarray
1439 The training set indices for that split.
1440
1441 test : ndarray
1442 The testing set indices for that split.
1443 """
1444 return super().split(X, y, groups)
1445
1446
1447class LeavePGroupsOut(GroupsConsumerMixin, BaseCrossValidator):

Callers 1

Calls 1

splitMethod · 0.45

Tested by 1