@@ -135,10 +135,10 @@ class LeaveOneOut(BaseCrossValidator):
135
135
>>> print(loo)
136
136
LeaveOneOut()
137
137
>>> for train_index, test_index in loo.split(X):
138
- ... print("TRAIN:", train_index, "TEST:", test_index)
139
- ... X_train, X_test = X[train_index], X[test_index]
140
- ... y_train, y_test = y[train_index], y[test_index]
141
- ... print(X_train, X_test, y_train, y_test)
138
+ ... print("TRAIN:", train_index, "TEST:", test_index)
139
+ ... X_train, X_test = X[train_index], X[test_index]
140
+ ... y_train, y_test = y[train_index], y[test_index]
141
+ ... print(X_train, X_test, y_train, y_test)
142
142
TRAIN: [1] TEST: [0]
143
143
[[3 4]] [[1 2]] [2] [1]
144
144
TRAIN: [0] TEST: [1]
@@ -222,9 +222,9 @@ class LeavePOut(BaseCrossValidator):
222
222
>>> print(lpo)
223
223
LeavePOut(p=2)
224
224
>>> for train_index, test_index in lpo.split(X):
225
- ... print("TRAIN:", train_index, "TEST:", test_index)
226
- ... X_train, X_test = X[train_index], X[test_index]
227
- ... y_train, y_test = y[train_index], y[test_index]
225
+ ... print("TRAIN:", train_index, "TEST:", test_index)
226
+ ... X_train, X_test = X[train_index], X[test_index]
227
+ ... y_train, y_test = y[train_index], y[test_index]
228
228
TRAIN: [2 3] TEST: [0 1]
229
229
TRAIN: [1 3] TEST: [0 2]
230
230
TRAIN: [1 2] TEST: [0 3]
@@ -398,9 +398,9 @@ class KFold(_BaseKFold):
398
398
>>> print(kf)
399
399
KFold(n_splits=2, random_state=None, shuffle=False)
400
400
>>> for train_index, test_index in kf.split(X):
401
- ... print("TRAIN:", train_index, "TEST:", test_index)
402
- ... X_train, X
8000
_test = X[train_index], X[test_index]
403
- ... y_train, y_test = y[train_index], y[test_index]
401
+ ... print("TRAIN:", train_index, "TEST:", test_index)
402
+ ... X_train, X_test = X[train_index], X[test_index]
403
+ ... y_train, y_test = y[train_index], y[test_index]
404
404
TRAIN: [2 3] TEST: [0 1]
405
405
TRAIN: [0 1] TEST: [2 3]
406
406
@@ -604,9 +604,9 @@ class StratifiedKFold(_BaseKFold):
604
604
>>> print(skf)
605
605
StratifiedKFold(n_splits=2, random_state=None, shuffle=False)
606
606
>>> for train_index, test_index in skf.split(X, y):
607
- ... print("TRAIN:", train_index, "TEST:", test_index)
608
- ... X_train, X_test = X[train_index], X[test_index]
609
- ... y_train, y_test = y[train_index], y[test_index]
607
+ ... print("TRAIN:", train_index, "TEST:", test_index)
608
+ ... X_train, X_test = X[train_index], X[test_index]
609
+ ... y_train, y_test = y[train_index], y[test_index]
610
610
TRAIN: [1 3] TEST: [0 2]
611
611
TRAIN: [0 2] TEST: [1 3]
612
612
@@ -769,9 +769,9 @@ class TimeSeriesSplit(_BaseKFold):
769
769
>>> print(tscv)
770
770
TimeSeriesSplit(max_train_size=None, n_splits=5)
771
771
>>> for train_index, test_index in tscv.split(X):
772
- ... print("TRAIN:", train_index, "TEST:", test_index)
773
- ... X_train, X_test = X[train_index], X[test_index]
774
- ... y_train, y_test = y[train_index], y[test_index]
772
+ ... print("TRAIN:", train_index, "TEST:", test_index)
773
+ ... X_train, X_test = X[train_index], X[test_index]
774
+ ... y_train, y_test = y[train_index], y[test_index]
775
775
TRAIN: [0] TEST: [1]
776
776
TRAIN: [0 1] TEST: [2]
777
777
TRAIN: [0 1 2] TEST: [3]
@@ -861,10 +861,10 @@ class LeaveOneGroupOut(BaseCrossValidator):
861
861
>>> print(logo)
862
862
LeaveOneGroupOut()
863
863
>>> for train_index, test_index in logo.split(X, y, groups):
864
- ... print("TRAIN:", train_index, "TEST:", test_index)
865
- ... X_train, X_test = X[train_index], X[test_index]
866
- ... y_train, y_test = y[train_index], y[test_index]
867
- ... print(X_train, X_test, y_train, y_test)
864
+ ... print("TRAIN:", train_index, "TEST:", test_index)
865
+ ... X_train, X_test = X[train_index], X[test_index]
866
+ ... y_train, y_test = y[train_index], y[test_index]
867
+ ... print(X_train, X_test, y_train, y_test)
868
868
TRAIN: [2 3] TEST: [0 1]
869
869
[[5 6]
870
870
[7 8]] [[1 2]
@@ -980,10 +980,10 @@ class LeavePGroupsOut(BaseCrossValidator):
980
980
>>> print(lpgo)
981
981
LeavePGroupsOut(n_groups=2)
982
982
>>> for train_index, test_index in lpgo.split(X, y, groups):
983
- ... print("TRAIN:", train_index, "TEST:", test_index)
984
- ... X_train, X_test = X[train_index], X[test_index]
985
- ... y_train, y_test = y[train_index], y[test_index]
986
- ... print(X_train, X_test, y_train, y_test)
983
+ ... print("TRAIN:", train_index, "TEST:", test_index)
984
+ ... X_train, X_test = X[train_index], X[test_index]
985
+ ... y_train, y_test = y[train_index], y[test_index]
986
+ ... print(X_train, X_test, y_train, y_test)
987
987
TRAIN: [2] TEST: [0 1]
988
988
[[5 6]] [[1 2]
989
989
[3 4]] [1] [1 2]
@@ -1405,7 +1405,7 @@ class ShuffleSplit(BaseShuffleSplit):
1405
1405
>>> print(rs)
1406
1406
ShuffleSplit(n_splits=5, random_state=0, test_size=0.25, train_size=None)
1407
1407
>>> for train_index, test_index in rs.split(X):
1408
- ... print("TRAIN:", train_index, "TEST:", test_index)
1408
+ ... print("TRAIN:", train_index, "TEST:", test_index)
1409
1409
TRAIN: [1 3 0 4] TEST: [5 2]
1410
1410
TRAIN: [4 0 2 5] TEST: [1 3]
1411
1411
TRAIN: [1 2 4 0] TEST: [3 5]
@@ -1414,7 +1414,7 @@ class ShuffleSplit(BaseShuffleSplit):
1414
1414
>>> rs = ShuffleSplit(n_splits=5, train_size=0.5, test_size=.25,
1415
1415
... random_state=0)
1416
1416
>>> for train_index, test_index in rs.split(X):
1417
- ... print("TRAIN:", train_index, "TEST:", test_index)
1417
+ ... print("TRAIN:", train_index, "TEST:", test_index)
1418
1418
TRAIN: [1 3 0] TEST: [5 2]
1419
1419
TRAIN: [4 0 2] TEST: [1 3]
1420
1420
TRAIN: [1 2 4] TEST: [3 5]
@@ -1508,7 +1508,7 @@ class GroupShuffleSplit(ShuffleSplit):
1508
1508
>>> gss.get_n_splits()
1509
1509
2
1510
1510
>>> for train_idx, test_idx in gss.split(X, y, groups):
1511
- ... print("TRAIN:", train_idx, "TEST:", test_idx)
1511
+ ... print("TRAIN:", train_idx, "TEST:", test_idx)
1512
1512
TRAIN: [2 3 4 5 6 7] TEST: [0 1]
1513
1513
TRAIN: [0 1 5 6 7] TEST: [2 3 4]
1514
1514
'''
@@ -1620,9 +1620,9 @@ class StratifiedShuffleSplit(BaseShuffleSplit):
1620
1620
>>> print(sss)
1621
1621
StratifiedShuffleSplit(n_splits=5, random_state=0, ...)
1622
1622
>>> for train_index, test_index in sss.split(X, y):
1623
- ... print("TRAIN:", train_index, "TEST:", test_index)
1624
- ... X_train, X_test = X[train_index], X[test_index]
1625
- ... y_train, y_test = y[train_index], y[test_index]
1623
+ ... print("TRAIN:", train_index, "TEST:", test_index)
1624
+ ... X_train, X_test = X[train_index], X[test_index]
1625
+ ... y_train, y_test = y[train_index], y[test_index]
1626
1626
TRAIN: [5 2 3] TEST: [4 1 0]
1627
1627
TRAIN: [5 1 4] TEST: [0 2 3]
1628
1628
TRAIN: [5 0 2] TEST: [4 3 1]
@@ -1837,9 +1837,9 @@ class PredefinedSplit(BaseCrossValidator):
1837
1837
>>> print(ps)
1838
1838
PredefinedSplit(test_fold=array([ 0, 1, -1, 1]))
1839
1839
>>> for train_index, test_index in ps.split():
1840
- ... print("TRAIN:", train_index, "TEST:", test_index)
1841
- ... X_train, X_test = X[train_index], X[test_index]
1842
- ... y_train, y_test = y[train_index], y[test_index]
1840
+ ... print("TRAIN:", train_index, "TEST:", test_index)
1841
+ ... X_train, X_test = X[train_index], X[test_index]
1842
+ ... y_train, y_test = y[train_index], y[test_index]
1843
1843
TRAIN: [1 2 3] TEST: [0]
1844
1844
TRAIN: [0 2] TEST: [1 3]
1845
1845
"""
0 commit comments